diff --git a/include/frg/aligned_storage.hpp b/include/frg/aligned_storage.hpp new file mode 100644 index 0000000..42b02ae --- /dev/null +++ b/include/frg/aligned_storage.hpp @@ -0,0 +1,27 @@ +#ifndef FRG_ALIGNED_STORAGE_HPP +#define FRG_ALIGNED_STORAGE_HPP + +#include +#include + +#include + +namespace frg FRG_VISIBILITY { + +template +struct alignas(Align) aligned_storage { + constexpr aligned_storage() + : buffer{0} { } + + char buffer[Size]; +}; + +template +using aligned_union = aligned_storage< + std::max({sizeof(T)...}), + std::max({alignof(T)...}) +>; + +} // namespace frg + +#endif // FRG_ALIGNED_STORAGE_HPP diff --git a/include/frg/eternal.hpp b/include/frg/eternal.hpp index 780ef9c..72204f8 100644 --- a/include/frg/eternal.hpp +++ b/include/frg/eternal.hpp @@ -4,26 +4,12 @@ #include #include #include -#include +#include #include namespace frg FRG_VISIBILITY { -template -struct alignas(Align) aligned_storage { - constexpr aligned_storage() - : buffer{0} { } - - char buffer[Size]; -}; - -template -using aligned_union = aligned_storage< - std::max({sizeof(T)...}), - std::max({alignof(T)...}) ->; - // Container for an object that deletes the object's destructor. // eternal always has a trivial destructor. template diff --git a/include/frg/manual_box.hpp b/include/frg/manual_box.hpp index 616c257..0b67d16 100644 --- a/include/frg/manual_box.hpp +++ b/include/frg/manual_box.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include namespace frg FRG_VISIBILITY { diff --git a/include/frg/optional.hpp b/include/frg/optional.hpp index 7b34cb4..f37fcd0 100644 --- a/include/frg/optional.hpp +++ b/include/frg/optional.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include namespace frg FRG_VISIBILITY { diff --git a/include/frg/rcu_radixtree.hpp b/include/frg/rcu_radixtree.hpp index 573a7ce..f434ff1 100644 --- a/include/frg/rcu_radixtree.hpp +++ b/include/frg/rcu_radixtree.hpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/frg/safe_int.hpp b/include/frg/safe_int.hpp index 4f7ce9c..5ced5f8 100644 --- a/include/frg/safe_int.hpp +++ b/include/frg/safe_int.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include diff --git a/include/frg/small_vector.hpp b/include/frg/small_vector.hpp index 4376d84..a96ed56 100644 --- a/include/frg/small_vector.hpp +++ b/include/frg/small_vector.hpp @@ -1,10 +1,11 @@ #pragma once +#include #include #include #include -#include +#include #include namespace frg FRG_VISIBILITY { diff --git a/include/frg/variant.hpp b/include/frg/variant.hpp index 4b4f429..96b0ce3 100644 --- a/include/frg/variant.hpp +++ b/include/frg/variant.hpp @@ -1,7 +1,8 @@ #pragma once -#include +#include #include +#include #include #include diff --git a/meson.build b/meson.build index 72e0ce2..52af216 100644 --- a/meson.build +++ b/meson.build @@ -6,6 +6,7 @@ incl = include_directories('include') if not get_option('frigg_no_install') install_headers( 'include/frg/algorithm.hpp', + 'include/frg/aligned_storage.hpp', 'include/frg/allocation.hpp', 'include/frg/array.hpp', 'include/frg/bitops.hpp',