-
Notifications
You must be signed in to change notification settings - Fork 2
valueList::copy
Igor Zarzycki edited this page Jan 23, 2022
·
2 revisions
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).
-
Container
- value container for collection elements to be passed. Default one isvalueList
for typeType
(see valueListForType).
#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;
}
Is sorter 1: true
Is sorter 2: false