GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing cplusplus.com — std::valarray operators Reference
valarray
function
<valarray>
std::valarray operators
Valarray operators
When both the left-hand side argument and the right-side one are valarray objects, the operation is performed between the corresponding elements in each object (the first element of the left one with the first of the right one, the second with the second, and so on...). When one of the arguments is a value, the operation is applied to all the elements in the valarray against that value. If the type held in the valarray does not itself support the operation, such an operation shall not be instantiated. The class also overloads operator= and operator[]. ParametersReturn valueFor the unary operators, a new valarray object with the modified values.For the compound assignment operators, the left-hand side valarray object. For the binary operators, a new valarray object with the results of performing the operation on each element. For the comparison operators, a valarray of bool elements with the result of each of the individual comparisons.The operators returning a valarray by value are allowed to return an object of a different type instead. Such a type is required to be implicitly convertible to valarray and be supported as argument for all functions taking valarray& arguments. This allows copy-on-write implementations.Example
Output:
ComplexityDepends on library implementation (operations may be parallelized).Iterator validityNo changes: Valid iterators, references and sub-arrays keep their validity.Data racesAll elements in valarray objects involved in the operation are accessed, and -if in a compound assignment- also modified.Exception safetyIf any operation performed on the elements throws an exception, it causes undefined behavior.If a function fails to allocate storage it needs, it may throw an exception (such as bad_alloc), although this is not mandated. See also
Home page | Privacy policy
© cplusplus.com, 2000-2026 - All rights reserved - v3.3.4s Spotted an error? contact us | |||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |