Is it guaranteed that once std::list
or std::forward_list
item is allocated, it will remain at the same memory location (address) until destroyed? Except, of course, for the list itself being copied.
If you look at the documentation for all the functions which don't destroy elements, (insert, emplace, push_back, etc...), you will see that they have a note that "no references are invalidated", which is equivalent to what you are asking (objects staying at the same memory location). So, yes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With