take a single argument and evaluate to a boolean constant. Such templates are referred to as template predicates.
References: Based on ideas in Table 3.1 from
Modern C++ Design,Andrei Alexandrescu (Addison-Wesley Professional, 2001)
Templates to manipulate
spec/template(also known as alias sequences).
Some operations on alias sequences are built into the language, such as S[i], which accesses the element at index i in the sequence. S[low .. high] returns a new alias sequence that is a slice of the old one.
For more information, see ctarguments, Compile-time Sequences, Compile-time Sequences.
take a single argument and evaluate to a boolean constant. Such templates are referred to as template predicates.
References: Based on ideas in Table 3.1 from
Modern C++ Design,Andrei Alexandrescu (Addison-Wesley Professional, 2001)
Creates a sequence of zero or more aliases. This is most commonly used as template parameters or arguments.
In previous versions of Phobos, this was known as TypeTuple.
Allows aliasing of any single symbol, type or compile-time expression.
Not everything can be directly aliased. An alias cannot be declared of - for example - a literal:
alias a = 4; //ErrorWith this template any single entity can be aliased:
alias b = Alias!4; //OKDitto
Instantiates the given template with the given parameters.
Used to work around syntactic limitations of D with regard to instantiating a template from an alias sequence (e.g. T[0]!(...) is not valid) or a template returning another template (e.g. Foo!(Bar)!(Baz) is not allowed).
Template | The template to instantiate. |
Params | The parameters with which to instantiate the template. |
if (args.length >= 1)Returns the index of the first occurrence of args[0] in the sequence args[1 .. $]. args may be types or compile-time values. If not found, -1 is returned.
if (args.length >= 1)Returns an AliasSeq created from args[1 .. $] with the first occurrence, if any, of args[0] removed.
if (args.length >= 1)Returns an AliasSeq created from args[1 .. $] with all occurrences, if any, of args[0] removed.
Returns an AliasSeq created from args with all duplicate types removed.
Returns an AliasSeq created from TList with the first occurrence of T, if found, replaced with U.
Ditto
Ditto
Ditto
if (args.length >= 2)Returns an AliasSeq created from args[2 .. $] with all occurrences of args[0], if any, replaced with args[1].
Returns an AliasSeq created from args with the order reversed.
Returns the type from TList that is the most derived from type T. If no such type is found, T is returned.
Returns an AliasSeq with the elements of TList sorted so that the most derived types come first.
Evaluates to AliasSeq!(fun!(args[0]), fun!(args[1]), ..., fun!(args[$ - 1])).
Filters an AliasSeq using a template predicate. Returns an AliasSeq of the elements which satisfy the predicate.
Negates the passed template predicate.
Combines several template predicates using logical AND, i.e. constructs a new predicate which evaluates to true for a given input T if and only if all of the passed predicates are true for T.
The predicates are evaluated from left to right, aborting evaluation in a short-cut manner if a false result is encountered, in which case the latter instantiations do not need to compile.
Combines several template predicates using logical OR, i.e. constructs a new predicate which evaluates to true for a given input T if and only at least one of the passed predicates is true for T.
The predicates are evaluated from left to right, aborting evaluation in a short-cut manner if a true result is encountered, in which case the latter instantiations do not need to compile.
if (isIterable!(typeof(iter)) && !isInfinite!(typeof(iter)))Converts any foreach-iterable entity (e.g. an input range) to an alias sequence.
iter | the entity to convert into an AliasSeq. It must be able to be able to be iterated over using a foreach-statement. |
AliasSeq containing the values produced by iterating over iter.Template by binding its first (left) or last (right) arguments
to args.
Behaves like the identity function when args is empty.
Template | template to partially apply |
args | arguments to bind |
TemplateDitto
Creates an AliasSeq which repeats items exactly n times.
if (Seq.length == 2)if (stepSize != 0)Selects a subset of Args by stepping with fixed stepSize over the sequence. A negative stepSize starts iteration with the last element.
stepSize | Number of elements to increment on each iteration. Can't be 0. |
Args | Template arguments. |
AliasSeq filtered by the selected stride.