It returns an iterator pointing to the first element in the valarray x.
DeclarationFollowing is the declaration for std::valarray::begin function.
template <class T> /*unspecified1*/ begin (valarray<T>& x);C++11
template <class T> /*unspecified1*/ begin (valarray<T>& x);Parameters
x − It is a valarray objects.
Return ValueIt returns an iterator pointing to the first element in the valarray x.
ExceptionsBasic guarantee − if any operation performed on the elements throws an exception.
Data racesAll elements effectively copied are accessed.
ExampleIn below example explains about std::valarray::begin function.
#include <iostream> #include <valarray> int main () { std::valarray<int> sam {0,10,20,30,40}; std::cout << "sam contains:"; for (auto it = begin(sam); it!=end(sam); ++it) std::cout << ' ' << *it; std::cout << '\n'; return 0; }
Let us compile and run the above program, this will produce the following result −
sam contains: 0 10 20 30 40
valarray.htm
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