[valarray.syn] (original) (raw)
29 Numerics library [numerics]
29.6 Numeric arrays [numarray]
29.6.1 Header synopsis [valarray.syn]
The header defines five class templates (valarray,slice_array,gslice_array,mask_array, andindirect_array), two classes (sliceandgslice), and a series of related function templates for representing and manipulating arrays of values.
Thevalarrayarray classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized.
Any function returning avalarray<T>is permitted to return an object of another type, provided all the const member functions ofvalarray<T>are also applicable to this type.
This return type shall not add more than two levels of template nesting over the most deeply nested argument type.248
Implementations introducing such replacement types shall provide additional functions and operators as follows:
- for every function taking aconst valarray<T>& other thanbegin andend, identical functions taking the replacement types shall be added;
- for every function taking twoconst valarray<T>&arguments, identical functions taking every combination ofconst valarray<T>&and replacement types shall be added.
In particular, an implementation shall allow avalarray<T>to be constructed from such replacement types and shall allow assignments and compound assignments of such types tovalarray<T>,slice_array<T>,gslice_array<T>,mask_array<T>andindirect_array<T>objects.
These library functions are permitted to throw abad_alloc exception if there are not sufficient resources available to carry out the operation.
Note that the exception is not mandated.