diff --git a/include/visit_struct/visit_struct_intrusive.hpp b/include/visit_struct/visit_struct_intrusive.hpp index fed65bd..a134cb9 100644 --- a/include/visit_struct/visit_struct_intrusive.hpp +++ b/include/visit_struct/visit_struct_intrusive.hpp @@ -382,6 +382,41 @@ static inline ::visit_struct::detail::Append_t); \ static_assert(true, "") +#define VISITABLE_INIT(TYPE, NAME, VALUE) \ +TYPE NAME = VALUE; \ +struct VISIT_STRUCT_MAKE_MEMBER_NAME(NAME) : \ + visit_struct::detail::member_ptr_helper \ +{ \ + static VISIT_STRUCT_CONSTEXPR const ::visit_struct::detail::char_array & member_name() { \ + return #NAME; \ + } \ +}; \ +static inline ::visit_struct::detail::Append_t \ + Visit_Struct_Get_Visitables__(::visit_struct::detail::Rank); \ +static_assert(true, "") + +#define VISITABLE_DIRECT_INIT(TYPE, NAME, ...) \ +TYPE NAME __VA_ARGS__; \ + struct VISIT_STRUCT_MAKE_MEMBER_NAME(NAME) : \ +visit_struct::detail::member_ptr_helper \ +{ \ + static VISIT_STRUCT_CONSTEXPR const ::visit_struct::detail::char_array& member_name() \ + { \ + return #NAME; \ + } \ +}; \ +static inline ::visit_struct::detail::Append_t \ + Visit_Struct_Get_Visitables__(::visit_struct::detail::Rank); \ +static_assert(true, "") + + + #define END_VISITABLES \ typedef VISIT_STRUCT_GET_REGISTERED_MEMBERS Visit_Struct_Registered_Members_List__; \ typedef ::visit_struct::detail::intrusive_tag Visit_Struct_Visitable_Structure_Tag__; \