As of version 10.0.40219.1 SP1Rel std::vector::_Insert_n() code goes like this:if (_Count == 0);else if (max_size() - size() < _Count)_Xlen(); // result too longelse if (capacity() < size() + _Count)//reallocateelse //skippedNow capacity() <= max_size() at all times. Which means that if capacity() >= size() + _Count (enough room) then automatically max_size() >= size() + _Count. Which means that whenever that code is invoked when a vector already has room (that's quite often) the check max_size() >= size() + _Count is redundant._Insert_n() should be redesigned like this:if (_Count == 0);else if(capacity() - size() < _Count ){ if( (max_size() - _Size < _Count) _Xlen(); //reallocate} else //as previouslyso that the check is done only if there's a need for reallocation in the first place.
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...