How would one go about identifying the types inside a boost::fusion vector?
e.g.
fusion::vector<int, double, string> v;
then something that would let me identify v[0]
as being type int
, v[1]
as type double
and v[2]
as type string
.
Thanks.
In order to extract an element from a boost::fusion::vector
you need to use boost::fusion::at_c
, like this:
boost::fusion::vector<int, std::string> v(1, "hello");
std::cout << boost::fusion::at_c<0>(v) << std::endl; // prints 1
The type at position N is:
boost::fusion::result_of::at_c<boost::fusion::vector<int, std::string>, 1>::type