Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
执行以下操作是否安全?
std::list<Something> someList; ... someList.push_back(Something(8)); Something* something = &someList.back();
我认为这是安全的,但我不完全确定。
谢谢
是的,该对象将一直有效,直到您从someList. 有关各种容器操作何时可以销毁对象的信息,请参阅迭代器无效规则。
someList