Subject: [Boost-bugs] [Boost C++ Libraries] #9840: phoenix V3 and stl container non const methods
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-04-06 08:10:47
#9840: phoenix V3 and stl container non const methods
------------------------------------+---------------------
Reporter: Theodore.Papadopoulo@⦠| Owner: theller
Type: Bugs | Status: new
Milestone: To Be Determined | Component: phoenix
Version: Boost 1.53.0 | Severity: Problem
Keywords: stl container method |
------------------------------------+---------------------
I'm using boost 1.53 (boost-devel-1.53.0-6.fc19.i686).
I think I found a bug with phoenix and stl methods. It looks like boost
assumes that all methods are const which is not true (eg vector::reserve).
I tried to change:
{{{
#define BOOST_PHOENIX_ADAPT_CALLABLE(NAME, FUNC, N)
\
template <BOOST_PHOENIX_typename_A(N)>
\
inline
\
typename
\
boost::phoenix::detail::expression::function_eval<
\
FUNC
\
, BOOST_PHOENIX_A(N)>::type const
\
NAME(BOOST_PHOENIX_A_const_ref_a(N))
\
{
\
return boost::phoenix::detail::expression::
\
function_eval<FUNC, BOOST_PHOENIX_A(N)>::
\
make(FUNC(), BOOST_PHOENIX_a(N));
\
}
\
}}}
into
{{{
#define BOOST_PHOENIX_ADAPT_CALLABLE(NAME, FUNC, N)
\
template <BOOST_PHOENIX_typename_A(N)>
\
inline
\
typename
\
boost::phoenix::detail::expression::function_eval<
\
FUNC
\
, BOOST_PHOENIX_A(N)>::type const
\
NAME(BOOST_PHOENIX_A_ref_a(N))
\
{
\
return boost::phoenix::detail::expression::
\
function_eval<FUNC, BOOST_PHOENIX_A(N)>::
\
make(FUNC(), BOOST_PHOENIX_a(N));
\
}
\
}}}
but that's not enough. That part of the problem remains in git.
But that is not sufficient, some other method in the chain imposes
constness.
phoenix should not try to impose constness IMHO, the chain of
instantiations should just pass the orginal type...
Here is a (not totally simplified as it uses spirit) example to reproduce
the problem:
{{{
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <boost/phoenix/stl.hpp>
#include <boost/spirit/include/qi_uint.hpp>
#include <boost/phoenix/phoenix.hpp>
std::vector<unsigned> L;
int
main() {
using namespace boost::spirit::qi;
using namespace boost::phoenix;
using boost::phoenix::arg_names::_1;
const std::string str("3 1 2 3");
std::string::const_iterator first = str.begin();
parse(first,str.end(), uint_[reserve(L,_1)] >> repeat(capacity(L))[
uint_ ]);
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9840> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC