Re: Help with STL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The problem is in the line

(*neigh) = &(changed_atms[changed_atms.size() -1]);

You are taking the address of an element of a vector and keeping that address long past the time it becomes invalid.

As soon as the vector grows, that address becomes invalid.

Even if the vector didn't grow, I think you are keeping the address after the whole vector goes out of scope. But I'm not sure of that. I am sure you are using the address while the vector is still in scope, but after it may have grown. That's bad enough.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux