public member function
<valarray>
std::valarray::size
Return size
Parameters
noneReturn Value
The number of elements in the valarray.size_t is an unsigned integral type.
Example
|
|
Output:
1. After construction: 0 2. After assignment: 5 3. After downsizing: 3 4. After resizing up: 10
Complexity
Depends on library implementation, but likely constant.Iterator validity
No changes: Valid iterators, references and sub-arrays keep their validity.Data races
The valarray is accessed, but its elements are not.Exception safety
Unspecified, but this member function shall not throw exceptions for valid valarray objects.See also
- valarray::resize
- Resize valarray (public member function)