Difference between revisions of "cpp/numeric/valarray"
m (Text replace - "{{tdcl list end" to "{{dcl list end") |
m (Text replace - "{{tdcl" to "{{dcl") |
||
Line 13: | Line 13: | ||
===Member types=== | ===Member types=== | ||
{{dcl list begin}} | {{dcl list begin}} | ||
− | {{ | + | {{dcl list hitem | Member type | Definition}} |
− | {{ | + | {{dcl list item | {{tt|value_type}} | {{tt|T}}}} |
{{dcl list end}} | {{dcl list end}} | ||
Revision as of 01:40, 12 June 2012
Template:cpp/numeric/valarray/sidebar
Defined in header <valarray>
|
||
template< class T > class valarray; |
||
std::valarray is the class for representing and manipulating arrays of values. It supports element-wise mathematical operations and various forms of generalized subscript operators, slicing and indirect access.
Contents |
Notes
std::valarray and helper classes are defined to be free of certain forms of aliasing, thus allowing operations on these classes to be optimized similar to the effect of the keyword restrict
in the C programming language. In addition, functions and operators that take valarray
arguments are allowed to return proxy objects to make it possible for the compiler to optimize an expression such as v1 = a*v2 + v3; as a single loop that executes v1[i] = a*v2[i] + v3[i]; avoiding any temporaries or multiple passes. However, expression templates make the same optimization technique available for any C++ container, and the majority of numeric libraries prefer expression templates to valarrays for flexibility. Most C++ standard library implementations use expression templates to implement efficient operations on std::valarray
, with rare exceptions such as Intel Parallel Studio, where valarrays are optimized even further.
Member types
Member type | Definition |
value_type
|
T
|