function template
<valarray>
std::begin (valarray) (1)template <class T> /*unspecified1*/ begin (valarray<T>& x);(2)
template <class T> /*unspecified2*/ begin (const valarray<T>& x);
Iterator to beginning
Returns an iterator pointing to the first element in the valarray x.Note that valarray objects have no member function begin defined nor have iterator member types: The iterator returned is a random-access iterator of an unspecified type whose value_type is T and its reference type is T&
for (1) and const T&
for (2) (it is a mutable iterator for (1), and a constant iterator for (2)).
If the object is an empty valarray, the returned value shall not be dereferenced.
This is an overload of begin, defined in <iterator>
(among other headers).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// begin/end valarray
#include <iostream> // std::cout
#include <valarray> // std::valarray
int main ()
{
std::valarray<int> foo {10,20,30,40,50};
std::cout << "foo contains:";
for (auto it = begin(foo); it!=end(foo); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
return 0;
}
foo contains: 10 20 30 40 50
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4