#include
#include <iostream>
#include
#include
#include
typedef boost::mpl::map<
boost::mpl::pair<
boost::mpl::int_<0>,
boost::mpl::int_<3>
>,
boost::mpl::pair<
boost::mpl::int_<1>,
boost::mpl::int_<2>
>,
boost::mpl::pair<
boost::mpl::int_<2>,
boost::mpl::int_<1>
>,
boost::mpl::pair<
boost::mpl::int_<3>,
boost::mpl::int_<0>
>
CMapForward;
typedef boost::mpl::map<
boost::mpl::pair<
boost::mpl::int_<0>,
boost::mpl::int_<3>
>,
boost::mpl::pair<
boost::mpl::int_<1>,
boost::mpl::int_<2>
>,
boost::mpl::pair<
boost::mpl::int_<2>,
boost::mpl::int_<1>
>,
boost::mpl::pair<
boost::mpl::int_<3>,
boost::mpl::int_<0>
>
CMapReverse;
template
struct CCreatePair:boost::mpl::pair >
{
};
struct CDoSomething
{ template
inline void operator()(const boost::mpl::pair &_r) const
{ std::cout << INDEX0 << " " << INDEX1 << "\n";
}
};
int main(int, char**)
{ boost::mpl::for_each<
CMapForward,
template CCreatePair
>(CDoSomething());
return 0;
}
"The first point (using an init() function in preference to a constructor) is bogus. Using constructors and exception handling is a more general and systematic way of dealing with resource acquisition and initialization errors. This style is a relic of pre-exception C++." -- Stroustrup