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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:49:21+00:00 2026-05-26T10:49:21+00:00

I just inserted into a vector and all is well, when I went to

  • 0

I just inserted into a vector and all is well, when I went to insert next, with the vector iterator currently pointing at vectorname.begin(). Since I only have one value, the guard I have should stop it from iterating, but it breaks for some reason. I feel like I’m not accessing the end correct, or stopping the iteration.. either way, here’s the code that’s breaking.

// check if iterator X and Y are equal to destX and destY
if(iter != this->playerVector.end())
{
    while((iter->myX != destX) && (iter->myY != destY) || (iter != this->playerVector.end()))
    {
        iter++;
    }
}

it breaks when checking the while statements after one iteration.

  • 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-26T10:49:21+00:00Added an answer on May 26, 2026 at 10:49 am

    It seems you are missing proper conditioning in the while loop and that’s why it’s always true (also put braces when you have various operators in place). Your condition should be,

    while((iter->myX != destX) && (iter->myY != destY) && (iter !=
    this->playerVector.end()))

    Following is another simple version of your while loop:

    while(iter != this->playerVector.end())
    {
      if(iter->myX == destX || iter->myY == destY)
        break;
      iter++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I retrieve the row just inserted? INSERT INTO LETTRE_VOIT select rsVoit.NOID, NO_ORDRE,
How to access the row which has just been inserted into a DB with
I'd like to use std::copy to insert elements into a queue like this: vector<int>
I just inserted 1million records into a simple sqlite table with five columns. It
I have a form being inserted into a page with jQuery. In all other
I am currently trying to insert data into a table called customer_quote , this
Just experimenting I've used this query on MySQL: insert into table_name (text_col) values (1919191919191919191919191...91919191)
How do I get the sequence number of the row just inserted?
I'm just getting my head around insert statements today after getting sick of cheating
Is it possible in MySQL to insert a row into table2 automatically when a

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.