diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/util.cpp | 1 | ||||
| -rw-r--r-- | lib/util.h | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/util.cpp b/lib/util.cpp deleted file mode 100644 index 408a76a..0000000 --- a/lib/util.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "util.h" @@ -35,6 +35,16 @@ inline constexpr auto GetFirst = Nth<0>; inline constexpr auto GetSecond = Nth<1>; inline constexpr auto GetSwapped = Nth<0, 1>; +template<typename T, typename M> struct Decompose { + consteval Decompose(M T::*) { } + + using ValueType = M; + using ContainerType = T; +}; + +template<auto MbrPtr> using MemberValueType = typename decltype(Decompose {MbrPtr})::ValueType; +template<auto MbrPtr> using ContainerType = typename decltype(Decompose {MbrPtr})::ContainerType; + template<typename T> bool createIfRequired(std::shared_ptr<T> & instance, std::weak_ptr<T> & common) |
