[MPL] mpl::at for AssociativeSequence
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!
https://svn.boost.org/trac/boost/ticket/3982 On Jun 12, 2012, at 12:11 PM, dariomt@gmail.com wrote:
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 mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Tue, Jun 12, 2012 at 9:11 AM, <dariomt@gmail.com> wrote:
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!
It seems there is a discrepancy between the documentation and the code; if you take a look at boost/mpl/at_fwd.hpp, it forward declares boost::mpl::at with only 2 template parameters :( Please file a trac ticket, and I'll try to find out what the correct resolution is on the developer's list. - Jeff
On Tue, Jun 12, 2012 at 10:39 AM, Jeffrey Lee Hellrung, Jr. < jeffrey.hellrung@gmail.com> wrote:
On Tue, Jun 12, 2012 at 9:11 AM, <dariomt@gmail.com> wrote:
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!
It seems there is a discrepancy between the documentation and the code; if you take a look at boost/mpl/at_fwd.hpp, it forward declares boost::mpl::at with only 2 template parameters :(
Please file a trac ticket, and I'll try to find out what the correct resolution is on the developer's list.
- Jeff
Argh, sorry dariomt, Gordon has found this already in the trac database :/ My trac searching skills are evidently pretty poor :( - Jeff
Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung <at> gmail.com> writes:
On Tue, Jun 12, 2012 at 10:39 AM, Jeffrey Lee Hellrung, Jr. <jeffrey.hellrung
On Tue, Jun 12, 2012 at 9:11 AM, <dariomt <at> gmail.com> wrote:
Hi list,I'm trying to use the version of mpl::at with three template
<at> gmail.com> wrote: 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?
It seems there is a discrepancy between the documentation and the code; if you
take a look at boost/mpl/at_fwd.hpp, it forward declares boost::mpl::at with only 2 template parameters :(Please file a trac ticket, and I'll try to find out what the correct resolution is on the developer's list.- Jeff
Argh, sorry dariomt, Gordon has found this already in the trac database :/ My
trac searching skills are evidently pretty poor :(- Jeff
Thank you both for the info. I'll use the workaround proposed in the trac ticket. Regards, Dario
participants (4)
-
dariomt
-
dariomt@gmail.com
-
Gordon Woodhull
-
Jeffrey Lee Hellrung, Jr.