Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2003-11-15 20:32:42

Hi Aleksey,

> If you have to care about broken compilers, I
> would recommend you to use 'bind' and 'select1st's metafunction-class form
> instead:
> typedef apply2<
> bind1<select1st<>,_2>
> , char
> , pair<int,bool>
> >::type res;
> This one is guaranteed to work for all library templates.

It turnes out that this workaround doesn't work with gcc 3.3. The following
code doesn't compile:

typedef mpl::vector4<
    mpl::pair<int, int*>,
    mpl::pair<short, short*>,
    mpl::pair<long, long*>,
    mpl::pair<char, char*>
> pairs;

typedef mpl::find_if<
    boost::is_same<mpl::bind1<mpl::select1st<>, mpl::_>, long> >::type iter;

BOOST_MPL_ASSERT_NOT_SAME(iter, mpl::end<pairs>::type);

On the other hand, gcc 3.3 doesn't need any workarounds, and one can use
select1st directly. Does this mean that I need #ifdef here, and which would
be the right configuration constant to use?



Boost list run by bdawes at, gregod at, cpdaniel at, john at