|
1 | 1 | // Written in the D programming language.
|
2 | 2 |
|
3 | 3 | /**
|
4 |
| - * Templates to manipulate template argument lists (also known as type lists). |
| 4 | + * Templates to manipulate |
| 5 | + * $(DDSUBLINK spec/template, variadic-templates, template parameter sequences) |
| 6 | + * (also known as $(I alias sequences)). |
5 | 7 | *
|
6 |
| - * Some operations on alias sequences are built in to the language, |
7 |
| - * such as TL[$(I n)] which gets the $(I n)th type from the |
8 |
| - * alias sequence. TL[$(I lwr) .. $(I upr)] returns a new type |
9 |
| - * list that is a slice of the old one. |
| 8 | + * Some operations on alias sequences are built into the language, |
| 9 | + * such as `S[i]`, which accesses the element at index `i` in the |
| 10 | + * sequence. `S[low .. high]` returns a new alias |
| 11 | + * sequence that is a slice of the old one. |
10 | 12 | *
|
11 |
| - * Several templates in this module use or operate on eponymous templates that |
| 13 | + * For more information, see $(DDLINK ctarguments, Compile-time Sequences, Compile-time Sequences). |
| 14 | + * |
| 15 | + * $(B Note:) Several templates in this module use or operate on eponymous templates that |
12 | 16 | * take a single argument and evaluate to a boolean constant. Such templates
|
13 | 17 | * are referred to as $(I template predicates).
|
14 | 18 | *
|
@@ -179,15 +183,15 @@ template AliasSeq(TList...)
|
179 | 183 | *
|
180 | 184 | * Not everything can be directly aliased. An alias cannot be declared
|
181 | 185 | * of - for example - a literal:
|
182 |
| - * |
183 |
| - * `alias a = 4; //Error` |
184 |
| - * |
| 186 | + * --- |
| 187 | + * alias a = 4; //Error |
| 188 | + * --- |
185 | 189 | * With this template any single entity can be aliased:
|
186 |
| - * |
187 |
| - * `alias b = Alias!4; //OK` |
188 |
| - * |
| 190 | + * --- |
| 191 | + * alias b = Alias!4; //OK |
| 192 | + * --- |
189 | 193 | * See_Also:
|
190 |
| - * To alias more than one thing at once, use $(LREF AliasSeq) |
| 194 | + * To alias more than one thing at once, use $(LREF AliasSeq). |
191 | 195 | */
|
192 | 196 | alias Alias(alias a) = a;
|
193 | 197 |
|
@@ -758,7 +762,7 @@ template MostDerived(T, TList...)
|
758 | 762 | }
|
759 | 763 |
|
760 | 764 | /**
|
761 |
| - * Returns the `AliasSeq` TList with the types sorted so that the most |
| 765 | + * Returns an `AliasSeq` with the elements of TList sorted so that the most |
762 | 766 | * derived types come first.
|
763 | 767 | */
|
764 | 768 | template DerivedToFront(TList...)
|
@@ -901,7 +905,7 @@ template anySatisfy(alias F, T...)
|
901 | 905 |
|
902 | 906 |
|
903 | 907 | /**
|
904 |
| - * Filters an $(D AliasSeq) using a template predicate. Returns a |
| 908 | + * Filters an $(D AliasSeq) using a template predicate. Returns an |
905 | 909 | * $(D AliasSeq) of the elements which satisfy the predicate.
|
906 | 910 | */
|
907 | 911 | template Filter(alias pred, TList...)
|
@@ -1033,7 +1037,7 @@ template templateAnd(Preds...)
|
1033 | 1037 | static assert(storesNegativeNumbers!int);
|
1034 | 1038 | static assert(!storesNegativeNumbers!string && !storesNegativeNumbers!uint);
|
1035 | 1039 |
|
1036 |
| - // An empty list of predicates always yields true. |
| 1040 | + // An empty sequence of predicates always yields true. |
1037 | 1041 | alias alwaysTrue = templateAnd!();
|
1038 | 1042 | static assert(alwaysTrue!int);
|
1039 | 1043 | }
|
@@ -1091,7 +1095,7 @@ template templateOr(Preds...)
|
1091 | 1095 | static assert( isPtrOrUnsigned!uint && isPtrOrUnsigned!(short*));
|
1092 | 1096 | static assert(!isPtrOrUnsigned!int && !isPtrOrUnsigned!(string));
|
1093 | 1097 |
|
1094 |
| - // An empty list of predicates never yields true. |
| 1098 | + // An empty sequence of predicates never yields true. |
1095 | 1099 | alias alwaysFalse = templateOr!();
|
1096 | 1100 | static assert(!alwaysFalse!int);
|
1097 | 1101 | }
|
@@ -1333,7 +1337,7 @@ private template SmartAlias(T...)
|
1333 | 1337 | }
|
1334 | 1338 |
|
1335 | 1339 | /**
|
1336 |
| - * Creates an `AliasSeq` which repeats a type or an `AliasSeq` exactly `n` times. |
| 1340 | + * Creates an `AliasSeq` which repeats `TList` exactly `n` times. |
1337 | 1341 | */
|
1338 | 1342 | template Repeat(size_t n, TList...)
|
1339 | 1343 | {
|
@@ -1400,7 +1404,7 @@ template Repeat(size_t n, TList...)
|
1400 | 1404 | }
|
1401 | 1405 |
|
1402 | 1406 | /**
|
1403 |
| - * Sorts a $(LREF AliasSeq) using $(D cmp). |
| 1407 | + * Sorts an $(LREF AliasSeq) using $(D cmp). |
1404 | 1408 | *
|
1405 | 1409 | * Parameters:
|
1406 | 1410 | * 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...)
|
1524 | 1528 | }
|
1525 | 1529 |
|
1526 | 1530 | /**
|
1527 |
| -Selects a subset of the argument list by stepping with fixed `stepSize` over the list. |
1528 |
| -A negative `stepSize` starts iteration with the last list element. |
| 1531 | +Selects a subset of `Args` by stepping with fixed `stepSize` over the sequence. |
| 1532 | +A negative `stepSize` starts iteration with the last element. |
1529 | 1533 |
|
1530 | 1534 | Params:
|
1531 | 1535 | stepSize = Number of elements to increment on each iteration. Can't be `0`.
|
1532 |
| - Args = Template arguments |
| 1536 | + Args = Template arguments. |
1533 | 1537 |
|
1534 |
| -Returns: A template argument list filtered by the selected stride. |
| 1538 | +Returns: An `AliasSeq` filtered by the selected stride. |
1535 | 1539 | */
|
1536 | 1540 | template Stride(int stepSize, Args...)
|
1537 | 1541 | if (stepSize != 0)
|
@@ -1578,7 +1582,7 @@ if (stepSize != 0)
|
1578 | 1582 | }
|
1579 | 1583 |
|
1580 | 1584 | /**
|
1581 |
| - * Instantiates the given template with the given list of parameters. |
| 1585 | + * Instantiates the given template with the given parameters. |
1582 | 1586 | *
|
1583 | 1587 | * Used to work around syntactic limitations of D with regard to instantiating
|
1584 | 1588 | * a template from an alias sequence (e.g. `T[0]!(...)` is not valid) or a
|
|
0 commit comments