A RetroSearch Logo

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

Search Query:

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

Issue 107: Valarray constructor is strange

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

107. Valarray constructor is strange

Section: 29.6.2 [template.valarray] Status: NAD Submitter: AFNOR Opened: 1998-10-07 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [template.valarray].

View all issues with NAD status.

Discussion:

The order of the arguments is (elem, size) instead of the normal (size, elem) in the rest of the library. Since elem often has an integral or floating point type, both types are convertible to each other and reversing them leads to a well formed program.

Proposed resolution:

Inverting the arguments could silently break programs. Introduce the two signatures (const T&, size_t) and (size_t, const T&), but make the one we do not want private so errors result in a diagnosed access violation. This technique can also be applied to STL containers.

Rationale:

The LWG believes that while the order of arguments is unfortunate, it does not constitute a defect in the standard. The LWG believes that the proposed solution will not work for valarray<size_t> and perhaps other cases.


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