Boost logo

Boost Users :

Subject: Re: [Boost-users] MPL and lambda
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-02-03 14:15:40


AMDG

Joseph Winston wrote:
> In http://lists.boost.org/Archives/boost/2003/11/56289.php, there was
> a question on how one should locate all the mpl::pair's that match a
> given type when one was only interested in the first item in the pair.
> The suggested solution looked like something like this:
>
> #include <boost/mpl/vector.hpp>
> #include <boost/mpl/pair.hpp>
> #include <boost/mpl/find.hpp>
> #include <boost/mpl/transform_view.hpp>
>
> int
> main(int, char **)
> {
> using namespace boost;
>
> typedef mpl::vector< mpl::pair<int, int*>, mpl::pair<short,
> short*>, mpl::pair<long, long*>, mpl::pair<char, char*> > pairs;
>
> typedef mpl::find< mpl::transform_view< pairs, mpl::select1st<> >,
> long >::type::base iter;
> }
>
> However, mpl::select1st<> no longer is a part of boost and I don't see
> how to accomplish this despite having "C++ Template Metaprogramming"
> in my hands. I'd like to know what is the correct way in a recent
> version of boost, to accomplish this.

mpl::first<mpl::_1>

In Christ,
Steven Watanabe


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