c++ - C++11: std::vector::shrink_to_fit complexity -


the article @ cppreference.com tells complexity of std::vector::shrink_to_fit constant. far know possible if elements not moved, because if complexity n. says all iterators, including past end iterator, potentially invalidated. means moving of elements defined possibility.

is article faulty? ... or there magic don't know about?

the article is faulty, fixed it.

while official standard doesn't complexity of std::vector::shrink_to_fit, in n3376 changed wording, thereby fixing dr 2033:

23.3.6.3:

void shrink_to_fit();

requires: t shall moveinsertable *this.

complexity: linear in size of sequence.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -