The C++ function std::tuple_element(std::array) provides compile-type indexed access to the type of the elements of the array using tuple-like interface.
DeclarationFollowing is the declaration for std::tuple_element(std::array) function form std::array header.
template< std::size_t I, class T, std::size_t N > struct tuple_element<I, array<T, N> >;Parameters
T − type for which the tuple size is obtained.
I − index of the element.
N − size of the array.
The following example shows the usage of std::tuple_element(std::array) function.
#include <iostream> #include <array> using namespace std; int main(void) { array <int, 5> arr = {1, 2, 3, 4, 5}; /* iterator pointing at the start of the array */ auto itr = arr.begin(); /* traverse complete container */ while (itr != arr.end()) { cout << *itr << " "; ++itr; /* increment iterator */ } cout << endl; return 0; }
Let us compile and run the above program, this will produce the following result −
1 2 3 4 5
array.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