Reputation: 2648
I am trying to wrap each element in an mpl::set
with some container, for example a std::vector
, although the actual type is is not important. How would I do this? Basically I want to go from this
using mySet = mpl::set<int, float, double>;
to this
using myNewSet = mpl::set<container<int>, container<float>, container<double>>;
I thought of making a class similar to mpl::insert
, however since I want the solution to be generic it has to somehow store the container
type within itself, which doesn't play well with the parameter type of mpl::fold
.
Upvotes: 0
Views: 113
Reputation: 2648
After some more searching, this seems to work fine:
using myNewSet = mpl::fold<
mySet,
mpl::set0<>,
mpl::insert<mpl::_1, container<mpl::_2>
>::type;
Upvotes: 1