testPrintSeq
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/for_each.hpp>
#include "boost/mpl/is_sequence.hpp"
//#include <boost/mpl/if.hpp>
#include <iostream>
template <bool IsSeq = true>
struct Print
{
template< typename U >
void operator()(U x)
{
std::cout << "Seq( ";
boost::mpl::for_each<U> ( value_printer() );
std::cout << ")";
}
};
template <>
struct Print<false>
{
template< typename U >
void operator()(U x)
{
std::cout << x << ' ';
}
};
struct value_printer
{
template< typename U > void operator()(U x)
{
typedef Print< boost::mpl::is_sequence<U>::value > print;;
//typedef boost::mpl::if_< boost::mpl::is_sequence<U>, printSeq, printItem>::type print;
print()(x);
}
};
void testPrintSeq()
{
typedef boost::mpl::range_c<int,0,10> R1;
typedef boost::mpl::range_c<int,5,10> R2;
typedef boost::mpl::vector< R1, R2 > V;
value_printer()( V() );
}
#include <boost/mpl/vector.hpp>
#include <boost/mpl/for_each.hpp>
#include "boost/mpl/is_sequence.hpp"
//#include <boost/mpl/if.hpp>
#include <iostream>
template <bool IsSeq = true>
struct Print
{
template< typename U >
void operator()(U x)
{
std::cout << "Seq( ";
boost::mpl::for_each<U> ( value_printer() );
std::cout << ")";
}
};
template <>
struct Print<false>
{
template< typename U >
void operator()(U x)
{
std::cout << x << ' ';
}
};
struct value_printer
{
template< typename U > void operator()(U x)
{
typedef Print< boost::mpl::is_sequence<U>::value > print;;
//typedef boost::mpl::if_< boost::mpl::is_sequence<U>, printSeq, printItem>::type print;
print()(x);
}
};
void testPrintSeq()
{
typedef boost::mpl::range_c<int,0,10> R1;
typedef boost::mpl::range_c<int,5,10> R2;
typedef boost::mpl::vector< R1, R2 > V;
value_printer()( V() );
}