Skip to content

valueList::since

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

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

Definded in "utility/valuelist.h".


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

#include "algorithm/issortedfortype"

#include <iostream>

int main()
{
 using whileCollection = 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

Clone this wiki locally