Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6869: spirit lex use phoenixV3 compile error
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-05 19:28:08
#6869: spirit lex use phoenixV3 compile error
-------------------------------+----------------------------
Reporter: anonymous | Owner: Joel de Guzman
Type: Bugs | Status: new
Milestone: To Be Determined | Component: spirit
Version: Boost 1.49.0 | Severity: Problem
Resolution: | Keywords: spirit lex
-------------------------------+----------------------------
Comment (by Nikita Kniazev <nok.raven@â¦>):
The Spirit examples wrongly uses `result_of` protocol. I am working on
fixing examples, but it is still WIP. To fix your problem, you should fix
`distance_func` like this:
{{{#!cpp
struct distance_func
{
template <typename Sig>
struct result;
template <typename F, typename Iterator1, typename Iterator2>
struct result<F(Iterator1 const&, Iterator2 const&)>
: boost::iterator_difference<Iterator1>
{};
template <typename F, typename Iterator1, typename Iterator2>
struct result<F(Iterator1&, Iterator2&)>
: result<F(Iterator1 const&, Iterator2 const&)>
{};
template <typename Iterator1, typename Iterator2>
typename result<distance_func(Iterator1&, Iterator2&)>::type
operator()(Iterator1& begin, Iterator2& end) const
{
return std::distance(begin, end);
}
};
}}}
Or it could be a little simpler (`std::distance` requires both iterators
to have the same type):
{{{#!cpp
struct distance_func
{
template <typename>
struct result;
template <typename F, typename Iterator>
struct result<F(Iterator, Iterator)>
: boost::iterator_difference<typename
boost::decay<Iterator>::type>
{};
template <typename Iterator>
typename result<distance_func(Iterator&, Iterator&)>::type
operator()(Iterator& begin, Iterator& end) const
{
return std::distance(begin, end);
}
};
}}}
-- Ticket URL: <https://svn.boost.org/trac10/boost/ticket/6869#comment:2> 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-12-05 19:34:54 UTC