What section of the C++ standard requires that set::erase calls destructors promptly

后端 未结 1 510

What section of the C++11 standard (here\'s a copy of a draft standard) requires associative containers like std::set, std::map, std::unordered_set, and std::unordered_map to im

1条回答
  •  梦毁少年i
    2021-02-07 12:21

    There are general requirements in the table for associative containers which describe the requirements for erase calls.

    E.g. a.erase(q) | erases the element pointed to by q.

    The element type for map is a pair of a key and a value. There is no sensible interpretation of "erases" that doesn't involve the proper destruction of the element (key and value). I doubt there is anything more explicitly worded for this situation in the standard.

    0 讨论(0)
提交回复
热议问题