Boost C++ Libraries: Ticket #13002: boost::prior does not compile when used with std::set reverse_iterator https://svn.boost.org/trac10/ticket/13002 <p> Given the following code snippet: </p> <pre class="wiki">#include &lt;boost/prior_next.hpp&gt; #include &lt;set&gt; int main(int argc, char *argv[]) { std::set&lt;int&gt; myints { 1, 2, 3, 4, 5 }; boost::prior(myints.rbegin(), 1); return 0; } </pre><p> This fails to compile against boost 1.61.0. </p> <pre class="wiki">$ 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&lt;_Iterator&gt;&amp; std::reverse_iterator&lt;_Iterator&gt;::operator-=(std::reverse_iterator&lt;_Iterator&gt;::difference_type) [with _Iterator = std::_Rb_tree_const_iterator&lt;int&gt;; std::reverse_iterator&lt;_Iterator&gt;::difference_type = long int]’: /usr/include/boost/next_prior.hpp:138:11: required from ‘static T boost::next_prior_detail::prior_impl1&lt;T, Distance, true&gt;::call(T, Distance) [with T = std::reverse_iterator&lt;std::_Rb_tree_const_iterator&lt;int&gt; &gt;; Distance = int]’ /usr/include/boost/next_prior.hpp:160:68: required from ‘T boost::prior(T, Distance) [with T = std::reverse_iterator&lt;std::_Rb_tree_const_iterator&lt;int&gt; &gt;; 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&lt;int&gt;’ and ‘std::reverse_iterator&lt;std::_Rb_tree_const_iterator&lt;int&gt; &gt;::difference_type {aka long int}’) current += __n; ^ </pre><p> 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. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13002 Trac 1.4.3 Andrey Semashev Sat, 08 Jul 2017 19:56:14 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/13002#comment:1 https://svn.boost.org/trac10/ticket/13002#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> Duplicates <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10847" title="#10847: Bugs: Offset overloads of next() / prior() have stopped compiling for ... (closed: fixed)">#10847</a>. </p> Ticket