Skip to content

valueList::copy

Igor Zarzycki edited this page Sep 8, 2019 · 2 revisions

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

Defined in "utility/valueList.h".


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 "utility/valuelist.h"

#include "algorithm/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

Clone this wiki locally