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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:43:13+00:00 2026-05-31T20:43:13+00:00

The following code is causing this error: if (bestLine.size() > searchDepth – depth) bestLine.erase(bestLine.begin(),

  • 0

The following code is causing this error:

if (bestLine.size() > searchDepth - depth)
    bestLine.erase(bestLine.begin(), bestLine.end() - searchDepth - depth);

When I checked the value of searchDepth - depth at the time of the error, it was 0.

So essentially,

if (bestLine.size() > 0)
    bestLine.erase(bestLine.begin(), bestLine.end());

is causing this error. (Or not. See comments below.)

To my knowledge the above code should erase the entire vector, which is the desired behavior in this case.

What am I doing wrong?

  • 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-31T20:43:15+00:00Added an answer on May 31, 2026 at 8:43 pm

    Try adding parentheses to your expression: bestLine.end() - (searchDepth - depth). The result is very different if simply evaluated left-to-right.

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

Sidebar

Related Questions

I am new to Python. The following code is causing an error when it
The following code is causing a This query contains references to items defined on
The following code returns this: error: expected unqualified-id before ‘for’ I can't find what
Here is the snippet of my code which is causing this error: for (a=0;
I am getting the following error: InvalidURLError: ApplicationError: 1 Checked my code, and logged
The following code is causing an intermittent crash on a Vista machine. using (SoundPlayer
The following code is causing me some problems. The third line causes a program
The following linq2sql code is causing me much headache and I was hoping someone
The following code is a simple thread game, that switches between threads causing the
The following code causes an error in IE: $(ul.sf-menu).supersubs({ minWidth: 10, maxWidth: 30, extraWidth:

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.