You can do this easily using boost::mpl::transform, which you can use with Fusion sequences (as long as you include the appropriate headers to make Fusion sequences behave as confirming MPL sequences):
#include <boost/range/any_range.hpp>
#include <boost/fusion/include/mpl.hpp> // Required to adapt Fusion to MPL
#include <boost/fusion/include/vector.hpp>
#include <boost/mpl/transform.hpp>
template < typename T >
struct EmbedInAnyRange
{
typedef boost::any_range< // no need for typename here
T, // no need for typename here
forward_pass_traversal_tag,
int, // not sure what this parameter is, I leave int...
std::ptrdiff_t
> type;
};
int main()
{
typedef boost::fusion::vector< double, int, char > Tuple;
typedef boost::mpl::transform<
Tuple,
EmbedInAnyRange< boost::mpl::_ >
>::type AnyRangeTuple;
AnyRangeTuple myTuple(
std::vector< double >(),
std::list< int >(),
std::vector< char >() );
}
If you want, you can put the transformation into its own metafunction:
template < typename Seq >
struct EmbedAllInAnyRange
{
typedef typename boost::mpl::transform< // typename needed
Seq,
EmbedInAnyRange< boost::mpl::_ >
>::type type;
};
...
typedef EmbedAllInRange< Tuple >::type AnyRangeTuple;