Skip to content

Commit 6c3b889

Browse files
authored
Merge pull request #6146 from ntrel/meta-docs
[trivial] Tweak `std.meta` docs merged-on-behalf-of: Jack Stouffer <[email protected]>
2 parents 1619579 + 8a0228d commit 6c3b889

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

std/meta.d

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
// Written in the D programming language.
22

33
/**
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)).
57
*
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.
1012
*
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
1216
* take a single argument and evaluate to a boolean constant. Such templates
1317
* are referred to as $(I template predicates).
1418
*
@@ -179,15 +183,15 @@ template AliasSeq(TList...)
179183
*
180184
* Not everything can be directly aliased. An alias cannot be declared
181185
* of - for example - a literal:
182-
*
183-
* `alias a = 4; //Error`
184-
*
186+
* ---
187+
* alias a = 4; //Error
188+
* ---
185189
* 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+
* ---
189193
* 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).
191195
*/
192196
alias Alias(alias a) = a;
193197

@@ -758,7 +762,7 @@ template MostDerived(T, TList...)
758762
}
759763

760764
/**
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
762766
* derived types come first.
763767
*/
764768
template DerivedToFront(TList...)
@@ -901,7 +905,7 @@ template anySatisfy(alias F, T...)
901905

902906

903907
/**
904-
* Filters an $(D AliasSeq) using a template predicate. Returns a
908+
* Filters an $(D AliasSeq) using a template predicate. Returns an
905909
* $(D AliasSeq) of the elements which satisfy the predicate.
906910
*/
907911
template Filter(alias pred, TList...)
@@ -1033,7 +1037,7 @@ template templateAnd(Preds...)
10331037
static assert(storesNegativeNumbers!int);
10341038
static assert(!storesNegativeNumbers!string && !storesNegativeNumbers!uint);
10351039

1036-
// An empty list of predicates always yields true.
1040+
// An empty sequence of predicates always yields true.
10371041
alias alwaysTrue = templateAnd!();
10381042
static assert(alwaysTrue!int);
10391043
}
@@ -1091,7 +1095,7 @@ template templateOr(Preds...)
10911095
static assert( isPtrOrUnsigned!uint && isPtrOrUnsigned!(short*));
10921096
static assert(!isPtrOrUnsigned!int && !isPtrOrUnsigned!(string));
10931097

1094-
// An empty list of predicates never yields true.
1098+
// An empty sequence of predicates never yields true.
10951099
alias alwaysFalse = templateOr!();
10961100
static assert(!alwaysFalse!int);
10971101
}
@@ -1333,7 +1337,7 @@ private template SmartAlias(T...)
13331337
}
13341338

13351339
/**
1336-
* Creates an `AliasSeq` which repeats a type or an `AliasSeq` exactly `n` times.
1340+
* Creates an `AliasSeq` which repeats `TList` exactly `n` times.
13371341
*/
13381342
template Repeat(size_t n, TList...)
13391343
{
@@ -1400,7 +1404,7 @@ template Repeat(size_t n, TList...)
14001404
}
14011405

14021406
/**
1403-
* Sorts a $(LREF AliasSeq) using $(D cmp).
1407+
* Sorts an $(LREF AliasSeq) using $(D cmp).
14041408
*
14051409
* Parameters:
14061410
* 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...)
15241528
}
15251529

15261530
/**
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.
15291533
15301534
Params:
15311535
stepSize = Number of elements to increment on each iteration. Can't be `0`.
1532-
Args = Template arguments
1536+
Args = Template arguments.
15331537
1534-
Returns: A template argument list filtered by the selected stride.
1538+
Returns: An `AliasSeq` filtered by the selected stride.
15351539
*/
15361540
template Stride(int stepSize, Args...)
15371541
if (stepSize != 0)
@@ -1578,7 +1582,7 @@ if (stepSize != 0)
15781582
}
15791583

15801584
/**
1581-
* Instantiates the given template with the given list of parameters.
1585+
* Instantiates the given template with the given parameters.
15821586
*
15831587
* Used to work around syntactic limitations of D with regard to instantiating
15841588
* a template from an alias sequence (e.g. `T[0]!(...)` is not valid) or a

0 commit comments

Comments
 (0)