A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue134 below:

Issue 134: vector constructors over specified

This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TC1 status.

134. vector constructors over specified

Section: 23.3.13.2 [vector.cons] Status: TC1 Submitter: Howard Hinnant Opened: 1999-03-06 Last modified: 2016-01-28

Priority: Not Prioritized

View all issues with TC1 status.

Discussion:

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.

Proposed resolution:

Change 23.3.13.2 [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.

Rationale:

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4