From 6635cee143eb4cf3882bac519b8c12b83b62de62 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 1 Apr 2026 14:21:10 +0100 Subject: Add helper to Decompose a member pointer --- lib/util.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/util.h') diff --git a/lib/util.h b/lib/util.h index b60b093..093462d 100644 --- a/lib/util.h +++ b/lib/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 struct Decompose { + consteval Decompose(M T::*) { } + + using ValueType = M; + using ContainerType = T; +}; + +template using MemberValueType = typename decltype(Decompose {MbrPtr})::ValueType; +template using ContainerType = typename decltype(Decompose {MbrPtr})::ContainerType; + template bool createIfRequired(std::shared_ptr & instance, std::weak_ptr & common) -- cgit v1.3