[Boost-bugs] [Boost C++ Libraries] #13002: boost::prior does not compile when used with std::set reverse_iterator

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