331
Hate when it happens (lemmy.kde.social)
submitted 9 months ago by tubbadu@lemmy.kde.social to c/memes@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] inetknght@lemmy.ml 1 points 9 months ago

iterators are invalidated when you push/pop a vector

[-] TimeSquirrel@kbin.social 3 points 9 months ago* (last edited 9 months ago)

I'm just using "[n]" to access each element and ".size()" to make sure I don't go over. Solved it now, was an off-by-one mistake deep in some other function I didn't catch. I was trying to access an element in the vector that didn't exist yet.

I have been playing with STL's built in iterators, but still in the process of learning how to use them. Thanks for the heads up though!

this post was submitted on 17 Jan 2024
331 points (96.4% liked)

Memes

45413 readers
1174 users here now

Rules:

  1. Be civil and nice.
  2. Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.

founded 5 years ago
MODERATORS