Skip to content

valueList::at

Igor Zarzycki edited this page Jan 23, 2022 · 7 revisions

crap :: valueList <Type, Values...> :: at

Defined in "crap/utility.d/valuelist.h".
Defined in "crap/utility".


template <class Type, Type ... Values> struct valueList
{
 /*...*/
 template <std :: size_t N> constexpr const static Type at = At <N> :: value;
 /*...*/
};

Member constant of valueList. Stores value from collection present at possition N. Passing N larger than or equal to size (see valueList :: size) will cause compilation error Index out of range.. Requires C++14 or higher language version.

Template parameters

  • N - possition of element to access. If N is larger than or equal to size (see valueList :: size) compilation error Index out of range. will appear.

Usage example

#include <crap/utility.d/valuelist.h>

#include <iostream>

int main()
{
 using test = crap :: valueList<unsigned int, 0u, 1u, 42u, 4u, 5u, 6u, 7u>;
 std :: cout << test :: template at<2u> << std :: endl;
 return 0;
}

Possible output

42

See also

Clone this wiki locally