unstd.generictuple

Various stuff for working with generic tuples.

A replacement for $(STDMODULE typetuple).

The following symbols from std.typetuple are publicly imported:

  • $(STDREF typetuple, staticIndexOf)
  • $(STDREF typetuple, NoDuplicates)
  • $(STDREF typetuple, MostDerived)
  • $(STDREF typetuple, DerivedToFront)

The following symbols from std.typetuple are superseded:

  • $(STDREF typetuple, Reverse), use RetroTuple instead
  • $(STDREF typetuple, EraseAll), use FilterTuple instead
  • $(STDREF typetuple, ReplaceAll), use MapTuple instead
  • $(STDREF typetuple, staticMap), use MapTuple instead
  • $(STDREF typetuple, anySatisfy), use anyTuple instead
  • $(STDREF typetuple, allSatisfy), use allTuple instead

The following symbols from std.typetuple are considered useless:

  • $(STDREF typetuple, Erase)
  • $(STDREF typetuple, Replace)
Generic tuple manipulation functions
CategoryFunctions
Searching$(MREF anyTuple)   $(MREF allTuple)  
Creation$(MREF RetroTuple)   $(MREF StrideTuple)   $(MREF ChainTuple)   $(MREF RoundRobinTuple)   $(MREF RadialTuple)   $(MREF RepeatTuple)   $(MREF ZipTuple)   $(MREF iotaTuple)   $(MREF IndexedTuple)   $(MREF ChunksTuple)  
Comparison$(MREF cmpTuple)   $(MREF equalTuple)  
Iteration$(MREF FilterTuple)   $(MREF groupTuple)   $(MREF JoinTuple)   $(MREF MapTuple)   $(MREF ReduceTuple)   $(MREF UniqTuple)  

Public Imports

std.typetuple
public import std.typetuple : staticIndexOf, NoDuplicates, MostDerived, DerivedToFront;

Members

Aliases

GenericTuple
alias GenericTuple(Args...) = Args

Creates a generic tuple out of a sequence of zero or more types, expressions, or aliases.

RadialTupleMiddle
alias RadialTupleMiddle(A...) = RadialTuple!(-1, A)

Creates a generic tuple comprised of all elemetns of A which are teken starting from a given point and progressively extending left and right from that point. If RadialTupleMiddle is used or startingIndex is -1 it is assumed that no initial point is given and iteration starts from the middle of A.

iotaTuple
alias iotaTuple(alias begin, alias end, alias step) = iotaTupleImpl!(CommonType!(typeof(begin), typeof(end), typeof(step)), begin, end, step)
alias iotaTuple(alias begin, alias end) = iotaTupleImpl!(CommonType!(typeof(begin), typeof(end)), begin, end, 1)
alias iotaTuple(alias end) = iotaTupleImpl!(typeof(end), 0, end, 1)

Returns expression tuple with elements going through the numbers begin, begin + step, begin + 2 * step, ..., up to and excluding end. The two-arguments version has step = 1. The one-argument version also has begin = 0. If begin < end && step < 0 or begin > end && step > 0 or begin == end, then an empty tuple is returned.

Enums

cmpTuple
eponymoustemplate cmpTuple(alias packedTuple1, alias packedTuple2)

Performs three-way lexicographical comparison on two packed generic tuples according to predicate pred.

equalTuple
eponymoustemplate equalTuple(alias packedTuple1, alias packedTuple2)

Detect whether two packed generic tuples packedTuple1 and packedTuple2 elements are equal according to binary predicate pred.

Templates

ChainTuple
template ChainTuple(packedTuples...)

Creates a generic tuple comprised of all elemetns of packed generic tuples packedTuples in sequence.

ChunksTuple
template ChunksTuple(size_t chunkSize, A...)

Creates a generic tuple comprised of packed generic tuples comprised of fixed-sized chunks of size chunkSize of A.

FilterTuple
template FilterTuple(alias pred, A...)

Creates a generic tuple comprised of elemetns of A for which a unary predicate pred is true.

IndexedTuple
template IndexedTuple(alias packedSourceTuple, alias packedIndicesTuple)

Creates a generic tuple comprised of elemetns of packed generic tuple packedSourceTuple reordered according to packed expression tuple packedIndicesTuple. packedIndicesTuple may include only a subset of the elements of packedSourceTuple and may also repeat elements.

JoinTuple
template JoinTuple(alias packedSeparatorTuple, packedTuples...)

Creates a generic tuple comprised of packed generic tuples packedTuples generic tuples joined together using packed generic tuple packedSeparatorTuple as a separator.

MapTuple
template MapTuple(alias Func, A...)

Creates a generic tuple comprised of results of applying unary template Func to elemetns of A consecutively.

PackedGenericTuple
template PackedGenericTuple(Args...)

Creates a packed generic tuple out of a sequence of zero or more types, expressions, or aliases.

PackedTypeTuple
template PackedTypeTuple(T...)

Creates a packed typetuple out of a sequence of zero or more types. Same as PackedGenericTuple, except it contains only types.

RadialTuple
template RadialTuple(size_t startingIndex, A...)

Creates a generic tuple comprised of all elemetns of A which are teken starting from a given point and progressively extending left and right from that point. If RadialTupleMiddle is used or startingIndex is -1 it is assumed that no initial point is given and iteration starts from the middle of A.

ReduceTuple
template ReduceTuple(alias Func, alias init, A...)

The instantiation of ReduceTuple!(Func, init, A) first lets result be init. Then, for each element x in A sequentially, it lets result be Inst!(BinaryTemplate!Func, result, x). Finally, result is returned.

ReduceTuple
template ReduceTuple(alias Func, Init, A...)
Undocumented in source.
RepeatTuple
template RepeatTuple(size_t n, A...)

Repeats A n times.

RetroTuple
template RetroTuple(A...)

Creates a generic tuple comprised of elemetns of A in reverse order.

RoundRobinTuple
template RoundRobinTuple(packedTuples...)

Creates a generic tuple comprised of all elemetns of packed generic tuples packedTuples in an order by analogy with Round-robin scheduling.

StrideTuple
template StrideTuple(size_t n, A...)

Creates a generic tuple comprised of elemetns of A taken with stride n.

TypeTuple
template TypeTuple(Types...)

Creates a typetuple out of a sequence of zero or more types. Same as GenericTuple, except it contains only types.

UniqTuple
template UniqTuple(alias pred, A...)

Creates a generic tuple comprised of unique consecutive elemetns of A.

ZipTuple
template ZipTuple(StoppingPolicy stoppingPolicy : StoppingPolicy.longest, alias empty, packedTuples...)
template ZipTuple(StoppingPolicy stoppingPolicy : StoppingPolicy.longest, empty, packedTuples...)
template ZipTuple(StoppingPolicy stoppingPolicy, packedTuples...)
template ZipTuple(packedTuples...)

Creates a generic tuple comprised of packed generic tuples comprised of elemetns of packed generic tuples packedTuples taken in lockstep.

allTuple
template allTuple(alias pred, A...)

Detect whether all elements of a generic tuple A satisfy the predicate pred.

anyTuple
template anyTuple(alias pred, A...)

Detect whether a generic tuple A contains an element satisfying the predicate pred.

cmpTuple
template cmpTuple(alias pred, alias packedTuple1, alias packedTuple2)

Performs three-way lexicographical comparison on two packed generic tuples according to predicate pred.

equalTuple
template equalTuple(alias pred, alias packedTuple1, alias packedTuple2)

Detect whether two packed generic tuples packedTuple1 and packedTuple2 elements are equal according to binary predicate pred.

expressionTuple
template expressionTuple(expressions...)

Creates an expression tuple out of a sequence of zero or more expressions. Same as GenericTuple, except it contains only expressions.

groupTuple
template groupTuple(alias pred, A...)

Similarly to UniqTuple, creates a generic tuple comprised of packed generic tuples comprised of unique consecutive elemetns of A and counts of equivalent elements seen.

packedExpressionTuple
template packedExpressionTuple(expr...)

Creates a packed expression tuple out of a sequence of zero or more expressions. Same as PackedGenericTuple, except it contains only expressions.

Meta

Authors

Denis Shelomovskij