Hi all,
I'm having some trouble getting the boost fusion tuple adapter working (the one that makes boost::tuples into conforming sequence types). I'm assuming that the adapted tuple should now be a legal MPL sequence but mpl::is_sequence yields false and consequently mpl::for_each doesn't work on the tuple type either. The following program is an illustration of what I am trying to do. I guess I must be missing something simple?
Any help would be appreciated.
Bill
#include <iostream>
#include <typeinfo>
#include
#include
#include
#include
#include
#include
#include
struct helper {
template <typename TT> void operator()(TT)
{
std::cout << typeid(TT).name() << std::endl;
}
};
int main()
{
typedef boost::fusion::tuple FTUP;
typedef boost::tuple BTUP;
// this works
std::cout << boost::mpl::is_sequence<FTUP>::value << std::endl;
std::cout << "fusion tuple\n";
boost::mpl::for_each<FTUP>(helper());
// this doesn't work
std::cout << boost::mpl::is_sequence<BTUP>::value << std::endl;
// the following lines won't compile because the BTUP is not a
// sequence type.
//std::cout << "boost tuple\n";
//mpl::for_each<BTUP>(helper());
return 0;
}