valueList::copy - HaxyM/crap GitHub Wiki

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

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


template <class Type, Type ... Values> struct valueList
{
 /*...*/
 template <template <Type...> class Container = valueListForType <Type> :: template type>
 using copy = Container<Values...>;
 /*...*/
};

Value source filling passed Container with all elements of collection preserving their order. If no container is passed, default one is valueList for type Type (see valueListForType).

Template parameters

Usage example

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

#include <crap/algorithm.d/issortedfortype.h>

#include <iostream>

int main()
{
 using collection1 = crap :: valueList<unsigned int, 0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u>;
 using collection2 = crap :: valueList<unsigned int, 0u, 1u, 2u, 42u, 4u, 5u, 6u, 7u>;
 using test1 = typename collection1 :: template copy<crap :: isSortedForType <unsigned int> :: template type>;
 using test2 = typename collection2 :: template copy<crap :: isSortedForType <unsigned int> :: template type>;
 std :: cout << "Is sorted 1: " << std :: boolalpha << test1 :: value << std :: endl;
 std :: cout << "Is sorter 2: " << std :: boolalpha << test2 :: value << std :: endl;
 return 0;
}

Possible output

Is sorter 1: true

Is sorter 2: false

See also

⚠️ **GitHub.com Fallback** ⚠️