Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL] Filtering a sequence to leave only most-derived types
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-02-23 06:36:55


Sebastian Redl wrote:

> How do I represent outer_value and inner_value in this expression? It
> seems I can't simply put mpl::_1 and mpl::_2 there, since that gives me a
> static assertion failure (argument is not available). I think I have to
> put an apply somewhere in there, but I can't figure out where.
>
> Sebastian

Not sure, but I would do something like

typedef mpl::vector< A, B, C > m_vec;

typedef mpl::sort<
    m_vec,
    boost::is_base_of< mpl::_1, mpl::_2 >
>::type sorted_type;

typedef mpl::unique<
    sorted_type,
    boost::is_base_of< mpl::_1, mpl::_2 >
>::type unique_type;

(untested, but I have the idea that it is close to what you would like it to
do :-))

Cheers,

Rutger


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