tanya.meta.metafunction

This module is suited for computations on template arguments, both types and values at compile time.

It contains different algorithms for iterating, searching and modifying template arguments.

Members

Aliases

Alias
alias Alias(alias T) = T
alias Alias(T) = T

Creates an alias for T.

AliasSeq
alias AliasSeq(Args...) = Args

Holds a sequence of aliases.

Enumerate
alias Enumerate(Args...) = EnumerateFrom!(0, Args)

Attaches a numeric index to each element from Args.

Instantiate
alias Instantiate(alias T, Args...) = T!Args

Instantiates the template T with Args.

Structs

Pack
struct Pack(Args...)

Holds a typed sequence of template parameters.

Set
struct Set(Args...)

Unordered sequence of unique aliases.

Templates

ApplyLeft
template ApplyLeft(alias T, Args...)
ApplyRight
template ApplyRight(alias T, Args...)
DerivedToFront
template DerivedToFront(L...)

Returns L sorted in such a way that the most derived types come first.

Difference
template Difference(alias S1, alias S2)

Produces a $(D_PSYMBOL Set) that contains all elements of S1 that are not members of S2.

EnumerateFrom
template EnumerateFrom(size_t start, Args...)

Attaches a numeric index to each element from Args.

Erase
template Erase(T, L...)
template Erase(alias T, L...)

Removes the first occurrence of T from the alias sequence $(D_PARAL L).

EraseAll
template EraseAll(T, L...)
template EraseAll(alias T, L...)

Removes all occurrences of T from the alias sequence $(D_PARAL L).

Filter
template Filter(alias pred, L...)

Returns an alias sequence which contains only items that satisfy the condition pred.

Intersection
template Intersection(Sets...)

Produces a $(D_PSYMBOL Set) that containing elements of Sets[0] that are also elements of all other sets in Sets.

Map
template Map(alias F, T...)

Applies F to all elements of T.

Max
template Max(alias pred, Args...)

Finds the maximum value in Args according to pred.

Min
template Min(alias pred, Args...)

Finds the minimum value in Args according to pred.

MostDerived
template MostDerived(T, L...)

Returns the type from the type tuple L that is most derived from T.

NoDuplicates
template NoDuplicates(L...)

Removes all duplicates from the alias sequence L.

Repeat
template Repeat(size_t n, L...)
Replace
template Replace(T, U, L...)
template Replace(alias T, U, L...)
template Replace(T, alias U, L...)
template Replace(alias T, alias U, L...)

Replaces the first occurrence of T in L with U.

ReplaceAll
template ReplaceAll(T, U, L...)
template ReplaceAll(alias T, U, L...)
template ReplaceAll(T, alias U, L...)
template ReplaceAll(alias T, alias U, L...)

Replaces all occurrences of T in L with U.

Reverse
template Reverse(L...)
Select
template Select(bool cond, T...)

Aliases itself to T[0] if cond is $(D_KEYWORD true), to T[1] if $(D_KEYWORD false).

Sort
template Sort(alias cmp, L...)

Sorts L in ascending order according to cmp.

Stride
template Stride(size_t n, Args...)

Produces a alias sequence consisting of every nth element of Args, starting with the first.

Union
template Union(Sets...)

Produces a $(D_PSYMBOL Set) containing all elements of the given Sets.

ZipWith
template ZipWith(alias f, Packs...)

Zips one or more $(D_PSYMBOL Pack)s with f.

aliasSeqOf
template aliasSeqOf(alias range)

Converts an input range range into an alias sequence.

isEqual
template isEqual(Args...)

Tests whether Args[0] is equal to Args[1].

isGreater
template isGreater(alias cmp, Args...)

Tests whether Args[0] is greater than Args[1] according to cmp.

isGreaterEqual
template isGreaterEqual(alias cmp, Args...)

Tests whether Args[0] is greater than or equal to Args[1] according to cmp.

isLess
template isLess(alias cmp, Args...)

Tests whether Args[0] is less than Args[1] according to cmp.

isLessEqual
template isLessEqual(alias cmp, Args...)

Tests whether Args[0] is less than or equal to Args[1] according to cmp.

isNotEqual
template isNotEqual(Args...)

Tests whether Args[0] isn't equal to Args[1].

isSorted
template isSorted(alias cmp, L...)

Tests whether L is sorted in ascending order according to cmp.

staticIndexOf
template staticIndexOf(T, L...)
template staticIndexOf(alias T, L...)

Returns the index of the first occurrence of T in L. -1 is returned if T is not found.

templateAnd
template templateAnd(Preds...)

Combines multiple templates with logical AND. So $(D_PSYMBOL templateAnd) evaluates to Preds[0] && Preds[1] && Preds[2] and so on.

templateNot
template templateNot(alias pred)
templateOr
template templateOr(Preds...)

Combines multiple templates with logical OR. So $(D_PSYMBOL templateOr) evaluates to Preds[0] || Preds[1] || Preds[2] and so on.

Variables

allSatisfy
enum bool allSatisfy(alias F, L...);

Tests whether all the items of L satisfy the condition F.

anySatisfy
enum bool anySatisfy(alias F, L...);

Tests whether any of the items of L satisfy the condition F.

canFind
enum bool canFind(T, L...);
enum bool canFind(alias T, L...);

Looks for T in L and returns $(D_KEYWORD true) if it could be found and $(D_KEYWORD false) otherwise.

Meta