Extracts the I
th element from the array using tuple-like interface.
I
must be an integer value in range [
â0â,
N)
. This is enforced at compile time as opposed to at() or operator[].
A reference to the I
th element of a.
Constant.
[edit] Example#include <array> #include <iostream> constexpr std::array v{1, 2, 3}; static_assert(get<0>(v) == 1 && get<1>(v) == 2 && get<2>(v) == 3); int main() { std::array<int, 3> a; // set values: get<0>(a) = 1, get<1>(a) = 2, get<2>(a) = 3; // get values: std::cout << '(' << get<0>(a) << ',' << get<1>(a) << ',' << get<2>(a) << ")\n"; }
Output:
[edit] Defect reportsThe following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior LWG 2485 C++11 there are no overloads for const array&& the overloads are added [edit] See alsoRetroSearch 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