A RetroSearch Logo

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

Search Query:

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

resize(n, t)'s specification should be simplified

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

2323. vector::resize(n, t)'s specification should be simplified

Section: 23.3.13.3 [vector.capacity], 23.3.5.3 [deque.capacity] Status: C++14 Submitter: Stephan T. Lavavej Opened: 2013-09-21 Last modified: 2017-07-05

Priority: 0

View other active issues in [vector.capacity].

View all other issues in [vector.capacity].

View all issues with C++14 status.

Discussion:

First, 23.3.5.3 [deque.capacity]/4 and 23.3.13.3 [vector.capacity]/16 say that resize(size_type sz, const T& c) "Requires: T shall be MoveInsertable into *this and CopyInsertable into *this." The CopyInsertable requirement is correct (because sz might be size() + 2 or more), but the MoveInsertable requirement is redundant due to 23.2.2 [container.requirements.general]/13: "T is CopyInsertable into X means that, in addition to T being MoveInsertable into X, the [...]". (LWG 2033(i)'s resolution said that this was "not redundant, because CopyInsertable is not necessarily a refinement of MoveInsertable" which was true at the time, but then LWG 2177(i)'s resolution made it a refinement.)

Second, 23.3.13.3 [vector.capacity]/17 says "Remarks: If an exception is thrown other than by the move constructor of a non-CopyInsertable T there are no effects." This is confusing because T is required to be CopyInsertable. (/14 says the same thing for resize(size_type sz), where it is correct because that overload requires only MoveInsertable and DefaultInsertable.)

[Issaquah 2014-02-11: Move to Immediate]

Proposed resolution:

This wording is relative to N3691.

  1. Edit 23.3.5.3 [deque.capacity]/4 as indicated:

    void resize(size_type sz, const T& c);
    

    […]

    -4- Requires: T shall be MoveInsertable into *this andCopyInsertable into *this.
  2. Edit 23.3.13.3 [vector.capacity]/16+17 as indicated:

    void resize(size_type sz, const T& c);
    

    […]

    -16- Requires: T shall be MoveInsertable into *this andCopyInsertable into *this. -17- Remarks: If an exception is thrown other than by the move constructor of a non-CopyInsertable T there are no effects.

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