STL containers element destruction order

前端 未结 2 1697
忘了有多久
忘了有多久 2020-11-30 08:58

Does ISO C++ standard mandate any sort of destruction order of objects inside STL containers?

  • Are std::list/std::vector/std::ma
2条回答
  •  长情又很酷
    2020-11-30 09:06

    1. Unspecified
    2. Yes, you can depend on std::map storing it's elements in std::pairs, but I don't see anything which specifies the Key portion of a std::pair being destructed before a Value portion.

提交回复
热议问题