Title
vector constructors over specified
Status
tc1
Section
[vector.cons]
Submitter
Howard Hinnant

Created on 1999-03-06.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

Rationale:

"at most 2N calls" is correct only if the growth factor is greater than or equal to 2.

Date: 2010-10-21.18:28:33

Proposed resolution:

Change [vector.cons], paragraph 1 to:

-1- Complexity: The constructor template <class InputIterator> vector(InputIterator first, InputIterator last) makes only N calls to the copy constructor of T (where N is the distance between first and last) and no reallocations if iterators first and last are of forward, bidirectional, or random access categories. It makes order N calls to the copy constructor of T and order logN reallocations if they are just input iterators.

Date: 1999-03-06.00:00:00

The complexity description says: "It does at most 2N calls to the copy constructor of T and logN reallocations if they are just input iterators ...".

This appears to be overly restrictive, dictating the precise memory/performance tradeoff for the implementor.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1637
2010-10-21 18:28:33adminsetmessages: + msg1636
1999-03-06 00:00:00admincreate