Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpl] Using max_element inside a fold while constructing a vector
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-05-31 14:59:23


AMDG

On 05/29/2013 08:55 PM, Brendon Costa wrote:
> I have been using boost.mpl for the first time recently and have solved a
> number of tasks with boost.mpl now but have a problem with a bit of code I
> thought should be working.
>
> What is wrong with this bit of code using boost.mpl?
>
> typedef vector<int_<0>, int_<3>, int_<2> > v1;
>
> // I want to use max_element on a vector I am in the process of
> constructing using a fold
> typedef typename fold<v1, vector<int_<0> >, push_back<_1,
> deref<max_element<_1>::type >::type> >::type v2;
>

try push_back<_1, deref<max_element<_1> > >.
i.e. don't use ::type in an MPL Lambda expression.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net