summaryrefslogtreecommitdiff
path: root/asl/layout.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'asl/layout.hpp')
-rw-r--r--asl/layout.hpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/asl/layout.hpp b/asl/layout.hpp
new file mode 100644
index 0000000..5141456
--- /dev/null
+++ b/asl/layout.hpp
@@ -0,0 +1,29 @@
+#pragma once
+
+#include "asl/integers.hpp"
+#include "asl/meta.hpp"
+
+namespace asl
+{
+
+template<typename T>
+inline constexpr int64_t size_of = static_cast<int64_t>(sizeof(T));
+
+template<typename T>
+inline constexpr int64_t align_of = static_cast<int64_t>(alignof(T));
+
+struct layout
+{
+ int64_t size;
+ int64_t align;
+
+ constexpr bool operator==(const layout&) const = default;
+
+ template<is_object T>
+ static constexpr layout of()
+ {
+ return layout{ size_of<T>, align_of<T> };
+ }
+};
+
+} // namespace asl