|
Boost : |
Subject: Re: [boost] [mpl] mpl::c_str fails for mpl::push_back
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-11-09 14:28:26
----- Original Message -----
From: "vicente.botet" <vicente.botet_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Monday, November 08, 2010 6:01 PM
Subject: Re: [boost] [mpl] mpl::c_str fails for mpl::push_back
> I'll prepare a patch with the c_str parameter extension in a separated file, as it should not depend any more on mpl::string and could work with other sequences and the value_type trait in another file. Let me know if there is someting wrong.
Hi,
while trying to check c_str on set_c sequence I have found a behaviour that seems to a bug. With list_c, the following code works well,
typedef mpl::list_c<char, 'a'> str_type;
typedef mpl::begin<str_type>::type i0;
typedef mpl::next<i0>::type i1;
but with set_c
typedef mpl::set_c<char, 'a'> str_type;
typedef mpl::begin<str_type>::type i0;
typedef mpl::next<i0>::type i1;
I get the following compile error on gcc
../../../boost/mpl/set/aux_/iterator.hpp: In instantiation of `boost::mpl::next<boost::mpl::s_iter<main()::str_type, boost::mpl::set0_c<char> > >':
../../../boost/mpl/eval_if.hpp:38: instantiated from `boost::mpl::eval_if<boost::mpl::has_key<main()::str_type, mpl_::void_>, boost::mpl::identity<boost::mpl::s_iter<main()::str_type, boost::mpl::set0_c<char> > >, boost::mpl::next<boost::mpl::s_iter<main()::str_type, boost::mpl::set0_c<char> > > >'
../../../boost/mpl/set/aux_/iterator.hpp:38: instantiated from `boost::mpl::s_iter_get<main()::str_type, boost::mpl::set0_c<char> >'
../../../boost/mpl/set/aux_/iterator.hpp:57: instantiated from `boost::mpl::next<boost::mpl::s_iter<main()::str_type, boost::mpl::s_item<mpl_::integral_c<char, 'a'>, boost::mpl::set0_c<char> > > >'
c_str\c_str_pass.cpp:271: instantiated from here
or this one with msvc
C:\cygwin\boost\v44\boost/mpl/set/aux_/iterator.hpp(56) : error C2039: 'base' : is not a member of 'boost::mpl::set0_c<T>'
with
[
T=char
]
C:\cygwin\boost\v44\boost/mpl/eval_if.hpp(41) : see reference to class template instantiation 'boost::mpl::next<T>' being compiled
with
[
T=boost::mpl::s_iter<str_type,boost::mpl::set0_c<char>>
]
C:\cygwin\boost\v44\boost/mpl/set/aux_/iterator.hpp(38) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled
with
[
C=boost::mpl::has_key<str_type,boost::mpl::set0<>::item_type_>,
F1=boost::mpl::identity<boost::mpl::s_iter<str_type,boost::mpl::set0_c<char>>>,
F2=boost::mpl::next<boost::mpl::s_iter<str_type,boost::mpl::set0_c<char>>>
]
C:\cygwin\boost\v44\boost/mpl/set/aux_/iterator.hpp(57) : see reference to class template instantiation 'boost::mpl::s_iter_get<Set,Tail>' being compiled
with
[
Set=str_type,
Tail=boost::mpl::set0_c<char>
]
c_str\c_str_pass.cpp(271) : see reference to class template instantiation 'boost::mpl::next<T>' being compiled
with
[
T=boost::mpl::s_iter<str_type,boost::mpl::s_item<boost::mpl::integral_c<char,97>,boost::mpl::set0_c<char>>>
]
BTW,
this works also
typedef mpl::set<mpl::char_<'a'> > str_type;
typedef mpl::begin<str_type>::type i0;
typedef mpl::next<i0>::type i1;
What is happening? Am I missing something evident or is this a real bug?
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk