![]() |
Home | Libraries | People | FAQ | More |
This module provides adapters for boost::variant.
Including the module header makes boost::variant
a fully conforming Forward
Sequence. The variant acts as a sequence of the types that can be
contained in the variant. Accessing types not currently stored int the variant
will lead to the variant being populated with a default constructed value
of that type.
#include <boost/fusion/adapted/variant.hpp> #include <boost/fusion/include/variant.hpp>
boost::variant<int,std::string> example_variant = 101; std::cout << example_variant << '\n'; *boost::fusion::find<std::string>(example_variant) = "hello"; std::cout << example_variant << '\n';