Section: 29.7.2 [template.valarray] Status: NAD Submitter: AFNOR Opened: 1998-10-07 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [template.valarray].
View all issues with NAD status.
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.
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.
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.