Boost logo

Boost :

From: Scott Graham (sgraham_at_[hidden])
Date: 2004-07-17 18:27:15


Hi

Is it possible to make mpl::at_c lambda-able? For example, the following
(dumb) code works as I would expect, but changing "at<_, int_<0> >" at //
XXX to "at_c<_, 0>" does not. BOOST_MPL_AUX_LAMBDA_SUPPORT is not in the
at_c struct, which is why it doesn't work I assume, but I don't know enough
about mpl to know if it can be added (nor how, if so).

----------
#include <boost/mpl/count_if.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/int.hpp>

int main()
{
    using namespace boost::mpl;

    typedef vector
    <
        vector_c<int, 9>,
        vector_c<int, 0>,
        vector_c<int, 6>,
        vector_c<int, 0>
>::type v;

    BOOST_STATIC_ASSERT((count_if
    <
        v,
        equal_to
        <
            int_<0>,
            at<_, int_<0> > // XXX
>
>::type::value == 2));
}
----------

thanks,
scott


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