6 #ifndef KAGOME_CORE_COMMON_DYNAMIC_VARIANT_HPP 7 #define KAGOME_CORE_COMMON_DYNAMIC_VARIANT_HPP 10 #include <type_traits> 13 #include <boost/mpl/at.hpp> 14 #include <boost/mpl/for_each.hpp> 15 #include <boost/mpl/int.hpp> 16 #include <boost/variant.hpp> 21 namespace dynamic_variant {
28 template <
typename Concrete,
typename Variant>
34 template <
typename Variant>
36 std::vector<std::function<void(Variant &)>> *
vec;
37 template <
typename Element>
39 vec->push_back(&init_variant<Element, Variant>);
58 template <
typename... Ts>
74 template <
typename Variant,
typename Types =
typename Variant::types>
77 std::vector<std::function<void(Variant &)>>
funcs_;
84 boost::mpl::for_each<Types>(builder);
100 #endif // KAGOME_CORE_COMMON_DYNAMIC_VARIANT_HPP Prepares initializers for each type of variant.
void init_variant(Variant &v)
std::vector< std::function< void(Variant &)> > * vec
VariantBuilder(Variant &v)
std::vector< std::function< void(Variant &)> > funcs_