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

  • Home
  • SEARCH
  • 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 6063743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:12:09+00:00 2026-05-23T09:12:09+00:00

I dont know whether bidirectional means i can write rbegin() or if i can

  • 0

I dont know whether bidirectional means i can write rbegin() or if i can decrease an iterator.

I have a tree that is forward only which isnt a problem. I’d like to walk it which is. What i am doing at the moment is every time i visit a branch i push current_iterator. Now the problem is i am iterating through a branch and called a function. The function needs to visit the previous nodes in the list.

So i wrote it=current_iterator and plan to write --it to rewind. As a quick test i wrote --o.begin()==o.end() to see if i can do this. I got a assert error.

I am using a deque. What container might i use that allows me to write = on an interator, go forward and backwards while in the middle of an iteration? It seems like i need to keep a copy of o as well so i could compare .begin() and .end(). What is the recommended container and technique?

  • 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-23T09:12:09+00:00Added an answer on May 23, 2026 at 9:12 am

    Deque iterators are random-access. You can increment and decrement them.

    The problem is probably that you tried to decrement the iterator returned by begin. Doing that is not guaranteed to give you the end of the list — deques aren’t circular. (I think it’s undefined behavior, so it could give you the end, but I doubt any implementations actually do it that way.)

    In other words, your test of whether you can decrement iterators wasn’t a valid test; the conclusion you drew from it that you can’t decrement iterators isn’t valid, either. You can decrement any valid deque iterator as long as the new location would also be valid.

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

Sidebar

Related Questions

I dont know whether this is correct posting place, can anybody please suggest me
I dont know whether I am reiventing the wheel. I need to design an
Whether this is possible I don't know, but it would mighty useful! I have
I dont know whether should I post this question here or not? But if
I dont know whether this simple task or not, but I tried to search
I would like to know whether i can get the drive information using the
I am woundering whether someone has time to normalize my database? I dont know
We know that the dateformat classes are not thread safe. I have a multi-threaded
I dont know whether it is possible or not,But here is my question: I
I have a byte array that can be of size 2,3 or 4. I

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.