Boost logo

Boost Users :

Subject: [Boost-users] [MPL] mpl::at for AssociativeSequence
From: dariomt_at_[hidden]
Date: 2012-06-12 12:11:21


Hi list,

I'm trying to use the version of mpl::at with three template parameters, as
specified here (
http://www.boost.org/doc/libs/1_46_0/libs/mpl/doc/refmanual/at.html)

But I'm getting a compiler error saying 'boost::mpl::at' : too many
template arguments.

What am I doing wrong?

#include <boost/mpl/map.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/type_traits/is_same.hpp>

using namespace boost;
using namespace boost::mpl;

typedef map<
      pair<int,unsigned>
    , pair<char,unsigned char>
    , pair<long_<5>,char[17]>
    , pair<int[42],bool>
> m;

BOOST_MPL_ASSERT_RELATION( size<m>::value, ==, 4 );
BOOST_MPL_ASSERT_NOT(( empty<m> ));

BOOST_MPL_ASSERT(( is_same< at<m,int>::type, unsigned > ));
BOOST_MPL_ASSERT(( is_same< at<m,long_<5> >::type, char[17] > ));
BOOST_MPL_ASSERT(( is_same< at<m,int[42]>::type, bool > ));
BOOST_MPL_ASSERT(( is_same< at<m,long>::type, void_ > ));

BOOST_MPL_ASSERT(( is_same< at<m,long,void_>::type, void_ > )); // fails!



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