Created
March 18, 2018 14:42
-
-
Save meetingcpp/a06e0ca694b57afb6271445a8d833722 to your computer and use it in GitHub Desktop.
Get member names of a fusion adapted struct with mp11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<class Seq> | |
constexpr std::array<const char*,boost::fusion::result_of::size<Seq>::value> get_member_names() | |
{ | |
std::array<const char*,boost::fusion::result_of::size<Seq>::value> members{}; | |
boost::mp11::mp_for_each< boost::mp11::mp_iota_c<boost::fusion::result_of::size<Seq>::value>>( | |
[&]( auto I ){ | |
members[I]=boost::fusion::extension::struct_member_name<Seq,I>::call(); | |
} ); | |
return members; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment