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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:33:45+00:00 2026-06-14T20:33:45+00:00

In a part of my code, I have a = cache[k1][k2][k3][k4]; cout << DEBUG:

  • 0

In a part of my code, I have

a = cache[k1][k2][k3][k4];
cout << "DEBUG: " << a << " " << cache[k1][k2][k3][k4] << endl;

And my cout has the following output:

DEBUG: 38 38
DEBUG: 3 3
DEBUG: 37 37
DEBUG: 4 35 <- the problem

I don’t understand what in the world is going on.

a,k1,k2,k3,k4 are integers and cache is a

vector<vector<vector<vector<int> > > >
  • 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-14T20:33:46+00:00Added an answer on June 14, 2026 at 8:33 pm

    The only way this could occur is if one of the indexes is out of bounds and so you’re accessing memory that’s outside of the vectors. The vector member function at works just like a subscript operator except that it does bounds checking, use it to detect this error.

    a = cache.at(k1).at(k2).at(k3).at(k4);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a Markdown string: * Bullet has *bold [code]*test[/code] part*. *Another\nbold* item.
I have the following code to cache instances of some class in a Concurrent
This is part of cachegrind output. This part of code has been executed for
I have this part of code in my functions.php: function cc_admin_enqueue_scripts($hook) { $file_dir=get_bloginfo('template_directory'); wp_enqueue_script('media-upload');
In my code I have to divs with different names, except the last part
i have this simple question please. I have this part of code which sets
I'm stuck on one thing i can't get solved. I have part of code,
I have part of the code below: while($array = $result->fetch_assoc() ){ $second_query = INSERT
I have some code that at one part will get executed a lot, and
I have a part of a code that counts what is in the x,y

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.