Subject: [Boost-bugs] [Boost C++ Libraries] #13002: boost::prior does not compile when used with std::set reverse_iterator
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-05-01 23:31:15
#13002: boost::prior does not compile when used with std::set reverse_iterator
-----------------------------------+---------------------------
Reporter: Cory Omand <comand@â¦> | Owner: no-maintainer
Type: Bugs | Status: new
Milestone: To Be Determined | Component: utility
Version: Boost 1.61.0 | Severity: Regression
Keywords: |
-----------------------------------+---------------------------
Given the following code snippet:
{{{
#include <boost/prior_next.hpp>
#include <set>
int main(int argc, char *argv[])
{
std::set<int> myints { 1, 2, 3, 4, 5 };
boost::prior(myints.rbegin(), 1);
return 0;
}
}}}
This fails to compile against boost 1.61.0.
{{{
$ g++ -std=c++11 boost-test.cpp
In file included from /usr/lib/gcc/x86_64-redhat-linux-
gnu/4.8.3/include/c++/iterator:63:0,
from /usr/include/boost/next_prior.hpp:15,
from boost-test.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux-
gnu/4.8.3/include/c++/bits/stl_iterator.h: In instantiation of
âstd::reverse_iterator<_Iterator>&
std::reverse_iterator<_Iterator>::operator-=(std::reverse_iterator<_Iterator>::difference_type)
[with _Iterator = std::_Rb_tree_const_iterator<int>;
std::reverse_iterator<_Iterator>::difference_type = long int]â:
/usr/include/boost/next_prior.hpp:138:11: required from âstatic T
boost::next_prior_detail::prior_impl1<T, Distance, true>::call(T,
Distance) [with T =
std::reverse_iterator<std::_Rb_tree_const_iterator<int> >; Distance =
int]â
/usr/include/boost/next_prior.hpp:160:68: required from âT
boost::prior(T, Distance) [with T =
std::reverse_iterator<std::_Rb_tree_const_iterator<int> >; Distance =
int]â
boost-test.cpp:7:36: required from here
/usr/lib/gcc/x86_64-redhat-linux-
gnu/4.8.3/include/c++/bits/stl_iterator.h:265:10: error: no match for
âoperator+=â (operand types are âstd::_Rb_tree_const_iterator<int>â and
âstd::reverse_iterator<std::_Rb_tree_const_iterator<int>
>::difference_type {aka long int}â)
current += __n;
^
}}}
There do not appear to be any further changes to boost/next_prior.hpp
since the current state of that file in 1.61 after commit 651a869, so it
is identical to the header shipped in 1.64.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/13002> 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-05-01 23:36:37 UTC