• inetknght
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    iterators are invalidated when you push/pop a vector

    • TimeSquirrel@kbin.social
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      5 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!