valueList::since - HaxyM/crap GitHub Wiki

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

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 since = typename Since <N> :: template type<Conatainer>;
 /*...*/
};

Member type of valueList. Passes into Container subcollection of elements since N-th element till end (including N-th element). If N is size (see valueList :: size) then empty collection 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 0 is equivalent to call copy (see valueList :: copy) with Container.

Template parameters

  • N - possition of first copied element. Marks beginning of subcollection.
  • Container - value container to copy subcollection elements into. If none is given, default one 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 wholeCollection = crap :: valueList<unsigned int, 0u, 1u, 2u, 42u, 4u, 5u, 6u, 7u>;
 using test1 = typename wholeCollection :: template since<3u>;
 using test2 = typename wholeCollection :: template since<3u, 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

42, 4, 5, 6, 7,

false

See also

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