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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:47:23+00:00 2026-06-14T11:47:23+00:00

I am having an unexplained vector out of range error! for (unsigned int i

  • 0

I am having an unexplained vector out of range error!

for (unsigned int i = 0; i < studentsVector.size(); i++) {

    bool anyFailedFacultyCourse = false;
    bool anyFailedElectiveCourse = false;
    // Check if all faculty courses are done
    std::cout << currentSemester << std::endl;
    if (currentSemester > 1) {
        std::cout << "hi" << std::endl;

        for (int j = 0; j < currentSemester - 1; j++) {
            if (studentsVector.at(i)->getPlan().at(j).size() > 0) {

                anyFailedFacultyCourse = true;
            }
        }

        std::cout << "bye" << std::endl;

After debugging, I noticed that the program does get into the first for loop, assigns proper values for AnyFailedFacultyCourse and anyFailedElectiveCourse, prints the int currentSemester. And there it stops!
I put a debug breakpoint at:

if (currentSemester > 1)

and it just gives me an out_of_range error before it even checks! Meaning it does not even get into if (currentSemester > 1)
But there is nothing in between! I mean, how could it throw anything like that when, where it throws the error, I did NOTHING to any vector!

I know this is kind of mysterious, ask for any further information you need.

Further info:
How students vector is declared:

std::vector<Student*> studentsVector;
currentSemester:

int currentSemester = 1;
  • 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-14T11:47:24+00:00Added an answer on June 14, 2026 at 11:47 am

    I bet the breakpoint you set isn’t triggered because the condition isn’t true: that is with currentSemester being 1 the condition is clearly false and the code skips to whatever is happening after the conditional block. You haven’t shown what is happening, there, however.

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

Sidebar

Related Questions

I am having this unexplained ActiveRecord::Relation, undefined method error . I don't know why,
Having just added a new button in my web application, I get an error
Having the following code: #include <iostream> struct A { int x; A(){} ~A(){std::cout <<~A(<<x<<)\n;}
Having the following code: int main(int argc, char* argv[]) { // program code std::cout
Having a really hard time figuring this out. I need to submit a form
having code like this: public static readonly bool MaximumRecipientsReached; private static readonly IList<EmailAddress> Contacts;
Having this code I get the error: Exception in thread AWT-EventQueue-0 java.lang.NoClassDefFoundError: org/apache/axis/EngineConfiguration I
Having searched a whole lot of similair posts, workarounds, I decided to make my
Having trouble with each function... Will try to explain by example... In my code,
Having a hard time with labels on a ggplot2 plot. Here's a similar plot

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.