CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Sat, 19 Jul 2025 10:13:10 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/valarray/valarray/
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 19 Jul 2025 10:13:10 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"8338-R1vjhH2Oiixoz3/12Aek2uG+QUQ"
Content-Encoding: gzip
A valarray object is designed to hold an array of values, and easily perform mathematical operations on them. It also allows special mechanisms to refer to subsets of elements in the arrays (see its operator[] overload).
Most mathematical operations can be applied directly to valarray objects, including arithmetical and comparison operators, affecting all its elements.
The valarray specification allows for libraries to implement it with several efficiency optimizations, such as parallelization of certain operations, memory recycling or support for copy-on-reference / copy-on-write optimizations. Implementations may even replace valarray as the return type for standard functions described below, provided they behave as, and can be converted to, valarray objects.
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
valarray
- valarray::~valarray
- valarray operators
- valarray::valarray
member functions
non-member overloads
-
begin (valarray)C++11
-
end (valarray)C++11
-
swap (valarray)C++11
-
- Reference
- <valarray>
- valarray
class template
<valarray>
std::valarray
template <class T> class valarray;
Valarray class
Most mathematical operations can be applied directly to valarray objects, including arithmetical and comparison operators, affecting all its elements.
The valarray specification allows for libraries to implement it with several efficiency optimizations, such as parallelization of certain operations, memory recycling or support for copy-on-reference / copy-on-write optimizations. Implementations may even replace valarray as the return type for standard functions described below, provided they behave as, and can be converted to, valarray objects.
Template parameters
- T
- Type of the elements contained in the valarray.
This shall be a value type: i.e., an arithmetic type, a pointer, or a class that behaves like these (such as complex or another level of valarray).
Member types
member type | definition | description |
---|---|---|
value_type | The first template parameter (T) | The type of the elements in the valarray |
Member functions
- (constructor)
- valarray constructor (public member function)
- (destructor)
- Valarray destructor (public member function)
- valarray operators
- Valarray operators (function)
- apply
- Apply function (public member function)
- cshift
- Circularly shift elements (public member function)
- max
- Return greatest value (public member function)
- min
- Return smallest value (public member function)
- operator=
- Assign content (public member function)
- operator[]
- Access element or subscript (public member function)
- resize
- Resize valarray (public member function)
- shift
- Shift elements (public member function)
- size
- Return size (public member function)
- sum
- Return sum of elements (public member function)
- swap
- Swap valarray contents (public member function)
Non-member overloads
- valarray operators
- Valarray operators (function)
- swap
- Swap valarrays (function template)
- begin
- Iterator to beginning (function template)
- end
- Iterator to end (function template)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us