Boost logo

Boost Users :

Subject: Re: [Boost-users] mpl vector of pair access
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2013-04-19 13:59:45


On Fri, Apr 19, 2013 at 10:49 AM, Olaf Peter <ope-devel_at_[hidden]> wrote:

> must be mpl::vector<
>> mpl::vector< ...
>>
>>
>> Right :)
>>
>
> Thanks, now I want to find the maximum over all, but I've got lost. I got
> it working for
>
> typedef mpl::vector_c<std::size_t,
> 0, // undefined,
> 4, // foo,
> 7 // bar,
> > arity_info;
>
> struct max_arity
> : mpl::deref<
> mpl::max_element<arity_info>::**type
> >::type
> { };
>
> but not here with the vector<vector<>> :(
>

Sorry, you might have to be more specific? I'll give it a shot though. I
would think some combination of mpl::max_element (as you have above) with
mpl::transform (which transforms your vector<vector<...>> to a vector<...>
of the at_c<1>'s of the inner vector<...>s) might be what you want, but not
sure.

Alternatively, you can call mpl::max_element on the original
vector<vector<...>> nested sequence directly, using a custom comparator,
then extract at_c<1> of the (deref'ed) result.

If this is what want but you can't get either or both of the above to work,
holler back.

HTH,

- Jeff



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