Boost C++ Libraries: Ticket #11303: boost::next(i,n) compilation error with -D_GLIBCXX_DEBUG https://svn.boost.org/trac10/ticket/11303 <p> std::map provides bidirectional iterator while boost::next(i,n) tries to use the plus-assign which is random iterator specific. </p> <pre class="wiki">% g++ -Wall gcc-bug.cpp -c -Og -isystem ~/dvm/sandbox/buildenv/boost-1.58.0/include -D_GLIBCXX_DEBUG In file included from /usr/include/c++/4.9.2/debug/map.h:33:0, from /usr/include/c++/4.9.2/debug/map:33, from /usr/include/c++/4.9.2/map:66, from gcc-bug.cpp:2: /usr/include/c++/4.9.2/debug/safe_iterator.h: In instantiation of ‘__gnu_debug::_Safe_iterator&lt;_Iterator, _Sequence&gt;&amp; __gnu_debug::_Safe_iterator&lt;_Iterator, _Sequence&gt;::operator+=(const difference_type&amp;) [with _Iterator = std::_Rb_tree_iterator&lt;std::pair&lt;const int, int&gt; &gt;; _Sequence = std::__debug::map&lt;int, int&gt;; __gnu_debug::_Safe_iterator&lt;_Iterator, _Sequence&gt;::difference_type = long int]’: /home/pawels/dvm/sandbox/buildenv/boost-1.58.0/include/boost/next_prior.hpp:73:11: required from ‘static T boost::next_prior_detail::next_impl1&lt;T, Distance, true&gt;::call(T, Distance) [with T = __gnu_debug::_Safe_iterator&lt;std::_Rb_tree_iterator&lt;std::pair&lt;const int, int&gt; &gt;, std::__debug::map&lt;int, int&gt; &gt;; Distance = int]’ /home/pawels/dvm/sandbox/buildenv/boost-1.58.0/include/boost/next_prior.hpp:151:67: required from ‘T boost::next(T, Distance) [with T = __gnu_debug::_Safe_iterator&lt;std::_Rb_tree_iterator&lt;std::pair&lt;const int, int&gt; &gt;, std::__debug::map&lt;int, int&gt; &gt;; Distance = int]’ gcc-bug.cpp:8:66: required from here /usr/include/c++/4.9.2/debug/safe_iterator.h:357:13: error: no match for ‘operator+=’ (operand types are ‘std::_Rb_tree_iterator&lt;std::pair&lt;const int, int&gt; &gt;’ and ‘const difference_type {aka const long int}’) _M_current += __n; ^ </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11303 Trac 1.4.3 anonymous Thu, 14 May 2015 11:40:35 GMT attachment set https://svn.boost.org/trac10/ticket/11303 https://svn.boost.org/trac10/ticket/11303 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">gcc-bug.cpp</span> </li> </ul> Ticket anonymous Thu, 14 May 2015 11:48:34 GMT attachment set https://svn.boost.org/trac10/ticket/11303 https://svn.boost.org/trac10/ticket/11303 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">bug.cpp</span> </li> </ul> <p> testcase </p> Ticket raad@… Tue, 07 Jul 2015 21:22:17 GMT cc set https://svn.boost.org/trac10/ticket/11303#comment:1 https://svn.boost.org/trac10/ticket/11303#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">raad@…</span> added </li> </ul> Ticket Andrey Semashev Thu, 05 Jan 2017 02:24:26 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11303#comment:2 https://svn.boost.org/trac10/ticket/11303#comment:2 <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