Skip to content

valueList::Till(struct)

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

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> struct Till;
 /*...*/
};

Member type of valueList (see valueList). Creates subset of collection since begining till N-th element (not including N-th element - that gives first N elements). Giving N equal to 0 represents empty subset. Giving N equal to size (see valueList::size) represents while set. If N is larger than size (see valueList::size) compiler error Index out of range. will appear.

Template parameters

  • N - position of first element not present in subset. Equivalent to numer of first elements creating subset. Marks end of subset.

Layout

Member types

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

Possilbe output

0, 1, 2, 42, 4,

false

See also

Clone this wiki locally