Is it safe to do the following?
std::list<Something> someList;
...
someList.push_back(Something(8));
Something* something = &someList.back();
I would think it is safe but I'm not completely sure.
Thanks
Is it safe to do the following?
std::list<Something> someList;
...
someList.push_back(Something(8));
Something* something = &someList.back();
I would think it is safe but I'm not completely sure.
Thanks
 
    
    Yes the object will be valid until you erase it from the someList. See Iterator Invalidation Rules for information about when the objects can get destroyed for various container operations.