diff --git a/std/meta.d b/std/meta.d index 6d6fbe2d820..d233b20cc9f 100644 --- a/std/meta.d +++ b/std/meta.d @@ -1,14 +1,18 @@ // Written in the D programming language. /** - * Templates to manipulate template argument lists (also known as type lists). + * Templates to manipulate + * $(DDSUBLINK spec/template, variadic-templates, template parameter sequences) + * (also known as $(I alias sequences)). * - * Some operations on alias sequences are built in to the language, - * such as TL[$(I n)] which gets the $(I n)th type from the - * alias sequence. TL[$(I lwr) .. $(I upr)] returns a new type - * list that is a slice of the old one. + * 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. * - * Several templates in this module use or operate on eponymous templates that + * For more information, see $(DDLINK ctarguments, Compile-time Sequences, Compile-time Sequences). + * + * $(B Note:) Several templates in this module use or operate on eponymous templates that * take a single argument and evaluate to a boolean constant. Such templates * are referred to as $(I template predicates). * @@ -179,15 +183,15 @@ template AliasSeq(TList...) * * Not everything can be directly aliased. An alias cannot be declared * of - for example - a literal: - * - * `alias a = 4; //Error` - * + * --- + * alias a = 4; //Error + * --- * With this template any single entity can be aliased: - * - * `alias b = Alias!4; //OK` - * + * --- + * alias b = Alias!4; //OK + * --- * See_Also: - * To alias more than one thing at once, use $(LREF AliasSeq) + * To alias more than one thing at once, use $(LREF AliasSeq). */ alias Alias(alias a) = a; @@ -758,7 +762,7 @@ template MostDerived(T, TList...) } /** - * Returns the `AliasSeq` TList with the types sorted so that the most + * Returns an `AliasSeq` with the elements of TList sorted so that the most * derived types come first. */ template DerivedToFront(TList...) @@ -901,7 +905,7 @@ template anySatisfy(alias F, T...) /** - * Filters an $(D AliasSeq) using a template predicate. Returns a + * Filters an $(D AliasSeq) using a template predicate. Returns an * $(D AliasSeq) of the elements which satisfy the predicate. */ template Filter(alias pred, TList...) @@ -1033,7 +1037,7 @@ template templateAnd(Preds...) static assert(storesNegativeNumbers!int); static assert(!storesNegativeNumbers!string && !storesNegativeNumbers!uint); - // An empty list of predicates always yields true. + // An empty sequence of predicates always yields true. alias alwaysTrue = templateAnd!(); static assert(alwaysTrue!int); } @@ -1091,7 +1095,7 @@ template templateOr(Preds...) static assert( isPtrOrUnsigned!uint && isPtrOrUnsigned!(short*)); static assert(!isPtrOrUnsigned!int && !isPtrOrUnsigned!(string)); - // An empty list of predicates never yields true. + // An empty sequence of predicates never yields true. alias alwaysFalse = templateOr!(); static assert(!alwaysFalse!int); } @@ -1333,7 +1337,7 @@ private template SmartAlias(T...) } /** - * Creates an `AliasSeq` which repeats a type or an `AliasSeq` exactly `n` times. + * Creates an `AliasSeq` which repeats `TList` exactly `n` times. */ template Repeat(size_t n, TList...) { @@ -1400,7 +1404,7 @@ template Repeat(size_t n, TList...) } /** - * Sorts a $(LREF AliasSeq) using $(D cmp). + * Sorts an $(LREF AliasSeq) using $(D cmp). * * Parameters: * cmp = A template that returns a $(D bool) (if its first argument is less than the second one) @@ -1524,14 +1528,14 @@ template staticIsSorted(alias cmp, Seq...) } /** -Selects a subset of the argument list by stepping with fixed `stepSize` over the list. -A negative `stepSize` starts iteration with the last list element. +Selects a subset of `Args` by stepping with fixed `stepSize` over the sequence. +A negative `stepSize` starts iteration with the last element. Params: stepSize = Number of elements to increment on each iteration. Can't be `0`. - Args = Template arguments + Args = Template arguments. -Returns: A template argument list filtered by the selected stride. +Returns: An `AliasSeq` filtered by the selected stride. */ template Stride(int stepSize, Args...) if (stepSize != 0) @@ -1578,7 +1582,7 @@ if (stepSize != 0) } /** - * Instantiates the given template with the given list of parameters. + * 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