diff options
Diffstat (limited to 'asl/utility.hpp')
-rw-r--r-- | asl/utility.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/asl/utility.hpp b/asl/utility.hpp index 2cbf8db..2d9ef05 100644 --- a/asl/utility.hpp +++ b/asl/utility.hpp @@ -1,6 +1,7 @@ #pragma once
#include "asl/meta.hpp"
+#include "asl/layout.hpp"
#define ASL_MOVE(expr_) (static_cast<::asl::un_ref_t<decltype(expr_)>&&>(expr_))
@@ -17,6 +18,12 @@ T exchange(T& obj, U&& new_value) return old_value;
}
+template<trivially_copyable U, trivially_copyable T>
+constexpr U bit_cast(T value) requires (size_of<T> == size_of<U>)
+{
+ return __builtin_bit_cast(U, value);
+}
+
#define ASL_DELETE_COPY(T) \
T(const T&) = delete; \
T& operator=(const T&) = delete;
|