Thursday, 15 March 2012

c++ - std::vector::erase with equal arguments -



c++ - std::vector::erase with equal arguments -

is safe phone call iterative methods such stl container erase (the override taking 2 iterators), e.g. in case std::vector::erase(), both arguments beingness vec.end()? made experiment , looks phone call nothing, want sure can utilize safely in code, otherwise have test iterators , avoid erase() if they're equal.

c++ standard (n3337), 23.2.3, sequence containers, table 100 ('sequence container requirements) - row a.erase(q1,q2):

effects: erases elements in range [q1,q2).

this means a.erase(q,q) safe because nothing.

loki astari's reply this question has list of drafts of c++ standard. official re-create not freely available unfortunately, using n3337, seems closest c++11.

c++ stl

No comments:

Post a Comment