Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 924301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:19:51+00:00 2026-05-15T19:19:51+00:00

The documentation for boost’s specialized iterator adaptors states that boost::reverse_iterator Corrects many of the

  • 0

The documentation for boost’s specialized iterator adaptors states that boost::reverse_iterator “Corrects many of the shortcomings of C++98’s std::reverse_iterator.”

What are these shortcomings? I can’t seem to find a description of these shortcomings.

FOLLOW-UP QUESTION:

How does boost::reverse_iterator correct these shortcomings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:19:52+00:00Added an answer on May 15, 2026 at 7:19 pm

    Well, the big problem is that they’re not forward iterators, and there’s stuff that pretty much expect forward iterators. So, you have to do some funny conversions to get things to work. To name some issues

    1. Some versions of erase() and insert() require iterators rather than reverse iterators. That means that if you’re using a reverse iterators and you want to insert() or erase(), you’re going to have to use the reverse iterator’s base() function to get your hands on a forward iterator. There is no automatic conversion.

    2. base() returns the forward iterator equivalent to the reverse iterator in terms of insertion. That is, insert inserts in front of the current element. The element that the reverse iterator is pointing at, therefore, would be the wrong element to be pointing at if base() gave you an iterator that pointed at the same element. So, it points one forward, and you can use it for insertion.

    3. Because base() returns an iterator pointing at a different element, it’s the wrong element to use for erase(). If you called erase() on the iterator from base(), you’d erase one element forward in the container from the element that the reverse iterator points at, so you have to increment the reverse iterator before calling base() in order to get the correct forward iterator to use for erase().

    4. Whether you can even use base() with erase() to correctly erase an element depends entirely on your implementation. It works with gcc, but with Visual Studio they’re really just wrapping a forward iterator in a manner that makes it so that it doesn’t work to use erase() when dealing with reverse iterators and Visual Studio. I don’t recall whether insert() has the same problem, but reverse iterators don’t work the same between different implementations of C++ (according to the Visual Studio guys, the standard wasn’t clear enough), so it can be kind of hairy to use them for anything other than simply iterating over a container.

    There are probably other issues as well, but dealing with any type of iterator other than a non-const, forward iterator in C++ when doing anything other than simply iterating over a container can get a bit hairy – if you can even do it all – because so many functions require non-const forward iterators rather than any other kind of iterator.

    If you really want to know the differences between the various iterator types and the issues associated with them, I recommend reading Scott Meyer’s Effective STL. It has a great chapter on iterators.

    EDIT: As for how Boost’s reverse iterator corrects those shortcomings, I’m afraid that I don’t have a clue. I’m aware of some of the standard reverse iterator’s shortcomings and have been bitten by them in the past, but I’ve never used Boost much, so I’m not familiar with their reverse iterators at all. Sorry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From the documentation on the boost site for lexical cast it states that when
I don't well understand the difference betweeen these two lock classes. In boost documentation
During a conversation on boost::bind , it was noted that std::bind1st exists in C++03,
I can find tons of general purpose documentation on Boost.Build, but surprisingly nothing on
The Boost.Pool documentation says that (emphasis mine): The Boost Pool library is a header-only
I'm looking for documentation on boost::threadpool. I downloaded the source and documentation zip files.
I've stared at the Boost.Interprocess documentation for hours but still haven't been able to
I cannot find much documentation of the Boost version of discrete_distribution. After much Google
This is an embarrassing question, but even the well-written documentation provided with boost.interprocess hasn't
Can anyone describe the difference in behavior between BOOST_CHECK_CLOSE and BOOST_CHECK_CLOSE_FRACTION ? The documentation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.