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 8703901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:58:12+00:00 2026-06-13T02:58:12+00:00

I have deque and want to iter it backwards. I also need the index

  • 0

I have deque and want to iter it backwards. I also need the index (otherwise I’d use the reverse_iterator) so I tried:

if ( _children.size( ) > 0 ) // debugging purpose
{
    unsigned si( _children.size( ) ); // debugging purpose
    int s( _children.size( ) - 1 ); // debugging purpose
    for ( unsigned c ( 0 ) ; c < _children.size( ) ; ++c )
        if ( this->_children[ ( _children.size( ) - 1 ) - c ]->Topmost( ) && 
             this->_children[ ( _children.size( ) - 1 ) - c ]->BorderRectangle( ).IsIn( X , Y ) )
               return std::pair< int, WindowPointer >( ( _children.size( ) - 1 ) - c, this->_children[ ( _children.size( ) - 1 ) - c ]->WindowAt( x, y ) );

but I get a sigsev. After debugging I get that index was -65. I checked the _children.size( ) by

unsigned si = _children.size( );

and it is 4294967232. And

long s = _children.size( ) - 1;

is -65. How do I get such values? And how to fix this?

  • 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-06-13T02:58:12+00:00Added an answer on June 13, 2026 at 2:58 am

    You should use the reverse_iterator. If you want to keep track of an index, you can add a variable to your for loop like this:

    int counter = 0;
    for (xx::reverse_iterator it = yy.rbegin(); it != yy.rend(); ++it, ++counter) {
        // Do something
    }
    

    This is les error-prone than what you are doing.

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

Sidebar

Related Questions

I have a deque that contains std::arrays . I want to convert it to
I have a std::deque, and I want to insert an element at a specified
I have: void add_all_msgs(std::deque<Message>::iterator &iter); How can I make that function generic, so it
I have a class that i want to push_back into a deque. The problem
I have a Deque that contains this kind of stucts. struct New_Array { array<array<int,4>,4>
Lets say I have a structure struct s { std::deque<Object> q; //won't work with
I have a lot of deques defined, and when I need to do things
For example I have an array with about 10 elements in it. std::deque<int> d;
I have created an instance of a generic collection in C#, and need to
Note: This is not a question whether I should use list or deque. It's

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.