Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-06-22 07:50:22


On 06/21/2006 09:36 AM, Larry Evans wrote:
> How can the attached code be modified to
> find expected_t0 in expected_args?
[snip]
> typedef mpl::arg<1> expected_t0;
> typedef mpl::arg<2> expected_t1;
> typedef mpl::vector<expected_t0,expected_t1> expected_args;
> typedef mpl::find<expected_args,expected_t0>::type find_t0;
Use find_if with predicate arg:
   same_arg_as<1>

where:

template<int I>
struct same_arg_as
{
     template< typename T2 > struct apply
     {
         typedef typename is_same<mpl::arg<I>,T2>::type type;
     };
};


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk