Skip to content

Commit add1752

Browse files
authored
Merge pull request #24 from xenontrioxide/fix-for-pull-request-14
Fixes compile error from pull request #14
2 parents 8c91d22 + 0e853f4 commit add1752

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

include/visit_struct/visit_struct_intrusive.hpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,41 @@ static inline ::visit_struct::detail::Append_t<VISIT_STRUCT_GET_REGISTERED_MEMBE
382382
Visit_Struct_Get_Visitables__(::visit_struct::detail::Rank<VISIT_STRUCT_GET_REGISTERED_MEMBERS::size + 1>); \
383383
static_assert(true, "")
384384

385+
#define VISITABLE_INIT(TYPE, NAME, VALUE) \
386+
TYPE NAME = VALUE; \
387+
struct VISIT_STRUCT_MAKE_MEMBER_NAME(NAME) : \
388+
visit_struct::detail::member_ptr_helper<VISIT_STRUCT_CURRENT_TYPE, \
389+
TYPE, \
390+
&VISIT_STRUCT_CURRENT_TYPE::NAME> \
391+
{ \
392+
static VISIT_STRUCT_CONSTEXPR const ::visit_struct::detail::char_array<sizeof(#NAME)> & member_name() { \
393+
return #NAME; \
394+
} \
395+
}; \
396+
static inline ::visit_struct::detail::Append_t<VISIT_STRUCT_GET_REGISTERED_MEMBERS, \
397+
VISIT_STRUCT_MAKE_MEMBER_NAME(NAME)> \
398+
Visit_Struct_Get_Visitables__(::visit_struct::detail::Rank<VISIT_STRUCT_GET_REGISTERED_MEMBERS::size + 1>); \
399+
static_assert(true, "")
400+
401+
#define VISITABLE_DIRECT_INIT(TYPE, NAME, ...) \
402+
TYPE NAME __VA_ARGS__; \
403+
struct VISIT_STRUCT_MAKE_MEMBER_NAME(NAME) : \
404+
visit_struct::detail::member_ptr_helper<VISIT_STRUCT_CURRENT_TYPE, \
405+
TYPE, \
406+
&VISIT_STRUCT_CURRENT_TYPE::NAME> \
407+
{ \
408+
static VISIT_STRUCT_CONSTEXPR const ::visit_struct::detail::char_array<sizeof(#NAME)>& member_name() \
409+
{ \
410+
return #NAME; \
411+
} \
412+
}; \
413+
static inline ::visit_struct::detail::Append_t<VISIT_STRUCT_GET_REGISTERED_MEMBERS, \
414+
VISIT_STRUCT_MAKE_MEMBER_NAME(NAME)> \
415+
Visit_Struct_Get_Visitables__(::visit_struct::detail::Rank<VISIT_STRUCT_GET_REGISTERED_MEMBERS::size + 1>); \
416+
static_assert(true, "")
417+
418+
419+
385420
#define END_VISITABLES \
386421
typedef VISIT_STRUCT_GET_REGISTERED_MEMBERS Visit_Struct_Registered_Members_List__; \
387422
typedef ::visit_struct::detail::intrusive_tag Visit_Struct_Visitable_Structure_Tag__; \

0 commit comments

Comments
 (0)