C++ boost::fusion














































C++ boost::fusion



Description: Boost.Fusion makes it possible to create heterogeneous containers. For example, you can create a vector whose first element is an int and whose second element is a string. In addition, Boost.Fusion provides algorithms to process heterogeneous containers. You can think of Boost.Fusion as the standard library for heterogeneous containers.

Code:
#include<boost/fusion/tuple.hpp>
#include<iostream.h>
#include<string.h> Using namespace boost::fusion;
int main()
{
Typedef tuple<int , std::string , bool ,double> tuple_type;
Tuple_type t{ 5 , "Boost" , 'true' , 1.14};
Std::cout<< get<0>(t);
Std::cout<< get<1>(t);
Std::cout<< get<2>(t);
Std::cout<< get<3>(t);
}

Output:
5
Boost
True
1.14

Comments