Reverse mpl set<>
Please can someone post me the mpl to reverse an mpl::set<>. The mpl::reverse<> meta-function (unsurprisingly) requires a Front Extensible type, but I presume it's possible via a custom inserter. TIA.
AMDG On 04/25/2013 02:23 AM, Chard wrote:
Please can someone post me the mpl to reverse an mpl::set<>. The mpl::reverse<> meta-function (unsurprisingly) requires a Front Extensible type, but I presume it's possible via a custom inserter.
It's probably wrong to try to reverse an mpl::set. mpl::set doesn't guarantee that the elements appear in any specific order. In Christ, Steven Watanabe
Steven Watanabe <watanabesj <at> gmail.com> writes:
On 04/25/2013 02:23 AM, Chard wrote:
Please can someone post me the mpl to reverse an mpl::set<>.
It's probably wrong to try to reverse an mpl::set. mpl::set doesn't guarantee that the elements appear in any specific order.
But I presume mpl::set has _an_ order; I do not require any specific order. I'll try another tack: can an mpl::set be converted to an mpl::vector?
Gabriel Redner <gredner <at> gmail.com> writes:
I'll try another tack: can an mpl::set be converted to an mpl::vector?
typedef copy<your_set, back_inserter<vector<> > >::type your_vector;
Thanks; that answers my original question, if reverse[_copy] is used: typedef typename reverse<my_set, back_inserter<vector<> > >::type set_reversed_as_vector;
participants (3)
-
Chard
-
Gabriel Redner
-
Steven Watanabe