valueList::till - HaxyM/crap GitHub Wiki

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

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


template <class Type, Type ... Values> struct valueList
{
 /*...*/
 template <std :: size_t N, template <Type...> class Container = valueListForType <Type> :: template type>
 using till = typename Till <N> :: template type<Conatainer>;
 /*...*/
};

Member type of valueList. Passes into Container subset of collection since begining till N-th element (not including N-th element - that gives first N elements). If N is 0 then empty set is passed into Container. If N is larger than size (see valueList :: size) compiler error Index out of range. will appear. Passing N equal to size (see valueList :: size) is equivalent to call copy (see valueList :: copy) with Container.

Template parameters

  • N - possition of first not copied element. Marks end of subset.
  • Container - containr to copy subset elements into. By default it is valueList holding values of type Type (see valueList and valueListForType).

Usage example

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

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

#include <iostream>

int main()
{
 using whileCollection = crap :: valueList<unsigned int, 0u, 1u, 2u, 42u, 4u, 5u, 6u, 7u>;
 using test1 = typename wholeCollection :: template till<5u>;
 using test2 = typename wholeCollection :: template till<5u, crap :: isSortedForType <unsigned int> :: template type>;
 crap :: printer :: print(std :: cout, ", ", test1{});
 std :: cout << "\n" << std :: boolalpha << test2 :: value << std :: endl;
 return 0;
}

Possible output

0, 1, 2, 42, 4,

false

See also

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