diff --git a/index.d b/index.d index a887a7cf542..e7c60cb6382 100644 --- a/index.d +++ b/index.d @@ -3,9 +3,9 @@ Ddoc $(P Phobos is the standard runtime library that comes with the D language compiler.) -$(P Generally, the $(D std) namespace is used for the main modules in the -Phobos standard library. The $(D etc) namespace is used for external C/C++ -library bindings. The $(D core) namespace is used for low-level D runtime +$(P Generally, the `std` namespace is used for the main modules in the +Phobos standard library. The `etc` namespace is used for external C/C++ +library bindings. The `core` namespace is used for low-level D runtime functions.) $(P The following table is a quick reference guide for which Phobos modules to @@ -42,7 +42,7 @@ $(BOOKTABLE , $(TD Convenient operations commonly used with built-in arrays. Note that many common array operations are subsets of more generic algorithms that work with arbitrary ranges, so they are found in - $(D std.algorithm). + `std.algorithm`. ) ) $(TR @@ -89,9 +89,9 @@ $(BOOKTABLE , $(LINK2 std_datetime.html, std.datetime)$(BR) $(LINK2 core_time.html, core.time) ) - $(TD $(D std.datetime) provides convenient access to date and time + $(TD `std.datetime` provides convenient access to date and time representations.$(BR) - $(D core.time) implements low-level time primitives. + `core.time` implements low-level time primitives. ) ) $(TR @@ -100,8 +100,8 @@ $(BOOKTABLE , $(LINK2 std_exception.html, std.exception)$(BR) $(LINK2 core_exception.html, core.exception) ) - $(TD $(D std.exception) implements routines related to exceptions. - $(D core.exception) defines built-in exception types and low-level + $(TD `std.exception` implements routines related to exceptions. + `core.exception` defines built-in exception types and low-level language hooks required by the compiler. ) ) @@ -123,11 +123,11 @@ $(BOOKTABLE , $(LINK2 std_stdio.html, std.stdio) ) $(TD - $(D std.stdio) is the main module for I/O.$(BR) - $(D std.file) is for accessing the operating system's filesystem, - and $(D std.path) is for manipulating filesystem pathnames in a + `std.stdio` is the main module for I/O.$(BR) + `std.file` is for accessing the operating system's filesystem, + and `std.path` is for manipulating filesystem pathnames in a platform-independent way.$(BR) - Note that $(D std.stream) and $(D std.cstream) are older, + Note that `std.stream` and `std.cstream` are older, deprecated modules scheduled to be replaced in the future; new client code should avoid relying on them. ) @@ -139,9 +139,9 @@ $(BOOKTABLE , $(LINK2 std_typecons.html, std.typecons)$(BR) ) $(TD - $(D core.memory) provides an API for user code to control the + `core.memory` provides an API for user code to control the built-in garbage collector.$(BR) - $(D std.typecons) contains primitives for building scoped variables + `std.typecons` contains primitives for building scoped variables and reference-counted types. ) ) @@ -177,13 +177,13 @@ $(BOOKTABLE , multithreading, synchronization, and interacting with operating system processes.$(BR) - $(D core.atomic) provides primitives for lock-free concurrent + `core.atomic` provides primitives for lock-free concurrent programming.$(BR) - $(D core.sync.*) modules provide low-level concurrent + `core.sync.*` modules provide low-level concurrent programming building blocks.$(BR) - $(D core.thread) implements multithreading primitives. + `core.thread` implements multithreading primitives. ) ) $(TR @@ -209,9 +209,9 @@ $(BOOKTABLE , ) $(TD These modules provide the standard mathematical functions and numerical algorithms.$(BR) - $(D std.bigint) provides an arbitrary-precision integer type.$(BR) - $(D std.complex) provides a complex number type.$(BR) - $(D std.random) provides pseudo-random number generators. + `std.bigint` provides an arbitrary-precision integer type.$(BR) + `std.complex` provides a complex number type.$(BR) + `std.random` provides pseudo-random number generators. ) ) $(TR @@ -221,11 +221,11 @@ $(BOOKTABLE , $(LINK2 std_algorithm_package, std.algorithm)$(BR) $(LINK2 std_signals, std.signals) ) - $(TD $(D std.functional), along with the lazy algorithms of - $(D std.algorithm), provides utilities for writing functional-style + $(TD `std.functional`, along with the lazy algorithms of + `std.algorithm`, provides utilities for writing functional-style code in D.$(BR) - $(D std.signals) provides a signal-and-slots framework for + `std.signals` provides a signal-and-slots framework for event-driven programming. ) ) @@ -240,14 +240,14 @@ $(BOOKTABLE , ) $(TD Various modules for interacting with the execution environment and compiler.$(BR) - $(D std.getopt) implements parsing of command-line arguments.$(BR) - $(D std.compiler) provides compiler information, mainly the + `std.getopt` implements parsing of command-line arguments.$(BR) + `std.compiler` provides compiler information, mainly the compiler vendor string and language version.$(BR) - $(D std.system) provides information about the runtime environment, + `std.system` provides information about the runtime environment, such as OS type and endianness.$(BR) - $(D core.cpuid) provides information on the capabilities of the + `core.cpuid` provides information on the capabilities of the CPU the program is running on.$(BR) - $(D core.memory) allows user code to control the built-in garbage + `core.memory` allows user code to control the built-in garbage collector. ) ) @@ -266,34 +266,34 @@ $(BOOKTABLE , $(LINK2 std_encoding.html, std.encoding)$(BR) $(LINK2 std_windows_charset.html, std.windows.charset) ) - $(TD $(D std.string) contains functions that work specifically with + $(TD `std.string` contains functions that work specifically with strings.$(BR) Many string manipulations are special cases of more generic algorithms that work with general arrays, or generic ranges; these - are found in $(D std.array) and $(D std.algorithm).$(BR) + are found in `std.array` and `std.algorithm`.$(BR) - D strings are encoded in Unicode; $(D std.uni) provides operations - that work with Unicode strings in general, while $(D std.utf) deals + D strings are encoded in Unicode; `std.uni` provides operations + that work with Unicode strings in general, while `std.utf` deals with specific Unicode encodings and conversions between them.$(BR) - $(D std.format) provides $(D printf)-style format string + `std.format` provides `printf`-style format string formatting, with D's own improvements and extensions.$(BR) - For manipulating filesystem pathnames, $(D std.path) is + For manipulating filesystem pathnames, `std.path` is provided.$(BR) - $(D std.regex) is a very fast library for string matching and + `std.regex` is a very fast library for string matching and substitution using regular expressions.$(BR) - $(D std.ascii) provides routines specific to the ASCII subset of + `std.ascii` provides routines specific to the ASCII subset of Unicode. Windows-specific character set support is provided by - $(D std.windows.charset). + `std.windows.charset`. Rudimentary support for other string encodings is provided by - $(D std.encoding). + `std.encoding`. ) ) $(TR @@ -304,18 +304,18 @@ $(BOOKTABLE , $(LINK2 std_bitmanip.html, std.bitmanip)$(BR) $(LINK2 core_bitop.html, core.bitop)$(BR) ) - $(TD $(D std.conv) provides powerful automatic conversions between + $(TD `std.conv` provides powerful automatic conversions between built-in types as well as user-defined types that implement standard conversion primitives.$(BR) - $(D std.typecons) provides various utilities for type construction + `std.typecons` provides various utilities for type construction and compile-time type introspection. It provides facilities for constructing scoped variables and reference-counted types, as well as miscellaneous useful generic types such as tuples and flags.$(BR) - $(D std.bitmanip) provides various bit-level operations, bit - arrays, and bit fields. $(D core.bitop) provides low-level bit + `std.bitmanip` provides various bit-level operations, bit + arrays, and bit fields. `core.bitop` provides low-level bit manipulation primitives.$(BR) ) ) @@ -324,7 +324,7 @@ $(BOOKTABLE , $(TD $(LINK2 core_simd, core.simd)$(BR) ) - $(TD The $(D core.simd) module provides access to SIMD intrinsics in + $(TD The `core.simd` module provides access to SIMD intrinsics in the compiler.) ) ) diff --git a/std/algorithm/comparison.d b/std/algorithm/comparison.d index a57f30de748..d841d15558d 100644 --- a/std/algorithm/comparison.d +++ b/std/algorithm/comparison.d @@ -11,30 +11,30 @@ $(T2 among, Checks if a value is among a set of values, e.g. $(D if (v.among(1, 2, 3)) // `v` is 1, 2 or 3)) $(T2 castSwitch, - $(D (new A()).castSwitch((A a)=>1,(B b)=>2)) returns $(D 1).) + $(D (new A()).castSwitch((A a)=>1,(B b)=>2)) returns `1`.) $(T2 clamp, - $(D clamp(1, 3, 6)) returns $(D 3). $(D clamp(4, 3, 6)) returns $(D 4).) + $(D clamp(1, 3, 6)) returns `3`. $(D clamp(4, 3, 6)) returns `4`.) $(T2 cmp, - $(D cmp("abc", "abcd")) is $(D -1), $(D cmp("abc", "aba")) is $(D 1), - and $(D cmp("abc", "abc")) is $(D 0).) + $(D cmp("abc", "abcd")) is `-1`, $(D cmp("abc", "aba")) is `1`, + and $(D cmp("abc", "abc")) is `0`.) $(T2 equal, Compares ranges for element-by-element equality, e.g. - $(D equal([1, 2, 3], [1.0, 2.0, 3.0])) returns $(D true).) + $(D equal([1, 2, 3], [1.0, 2.0, 3.0])) returns `true`.) $(T2 levenshteinDistance, - $(D levenshteinDistance("kitten", "sitting")) returns $(D 3) by using + $(D levenshteinDistance("kitten", "sitting")) returns `3` by using the $(LUCKY Levenshtein distance _algorithm).) $(T2 levenshteinDistanceAndPath, $(D levenshteinDistanceAndPath("kitten", "sitting")) returns $(D tuple(3, "snnnsni")) by using the $(LUCKY Levenshtein distance _algorithm).) $(T2 max, - $(D max(3, 4, 2)) returns $(D 4).) + $(D max(3, 4, 2)) returns `4`.) $(T2 min, - $(D min(3, 4, 2)) returns $(D 2).) + $(D min(3, 4, 2)) returns `2`.) $(T2 mismatch, $(D mismatch("oh hi", "ohayo")) returns $(D tuple(" hi", "ayo")).) $(T2 predSwitch, - $(D 2.predSwitch(1, "one", 2, "two", 3, "three")) returns $(D "two").) + $(D 2.predSwitch(1, "one", 2, "two", 3, "three")) returns `"two"`.) ) Copyright: Andrei Alexandrescu 2008-. @@ -58,9 +58,9 @@ import std.traits; import std.typecons; // : tuple, Tuple; /** -Find $(D value) _among $(D values), returning the 1-based index -of the first matching value in $(D values), or $(D 0) if $(D value) -is not _among $(D values). The predicate $(D pred) is used to +Find `value` _among `values`, returning the 1-based index +of the first matching value in `values`, or `0` if `value` +is not _among `values`. The predicate `pred` is used to compare values, and uses equality by default. See_Also: @@ -112,7 +112,7 @@ template among(values...) } /** -Alternatively, $(D values) can be passed at compile-time, allowing for a more +Alternatively, `values` can be passed at compile-time, allowing for a more efficient search, but one that only supports matching on equality: */ @safe unittest @@ -196,22 +196,22 @@ private template indexOfFirstOvershadowingChoiceOnLast(choices...) Executes and returns one of a collection of handlers based on the type of the switch object. -$(D choices) needs to be composed of function or delegate handlers that accept -one argument. The first choice that $(D switchObject) can be casted to the type -of argument it accepts will be called with $(D switchObject) casted to that -type, and the value it'll return will be returned by $(D castSwitch). +`choices` needs to be composed of function or delegate handlers that accept +one argument. The first choice that `switchObject` can be casted to the type +of argument it accepts will be called with `switchObject` casted to that +type, and the value it'll return will be returned by `castSwitch`. There can also be a choice that accepts zero arguments. That choice will be -invoked if $(D switchObject) is null. +invoked if `switchObject` is null. If a choice's return type is void, the choice must throw an exception, unless all the choices are void. In that case, castSwitch itself will return void. -Throws: If none of the choice matches, a $(D SwitchError) will be thrown. $(D +Throws: If none of the choice matches, a `SwitchError` will be thrown. $(D SwitchError) will also be thrown if not all the choices are void and a void choice was executed without throwing anything. -Note: $(D castSwitch) can only be used with object types. +Note: `castSwitch` can only be used with object types. */ auto castSwitch(choices...)(Object switchObject) { @@ -476,7 +476,7 @@ unittest } /** -Returns $(D val), if it is between $(D lower) and $(D upper). +Returns `val`, if it is between `lower` and `upper`. Otherwise returns the nearest of the two. Equivalent to $(D max(lower, min(upper,val))). */ @@ -534,17 +534,17 @@ body // cmp /********************************** Performs three-way lexicographical comparison on two input ranges -according to predicate $(D pred). Iterating $(D r1) and $(D r2) in -lockstep, $(D cmp) compares each element $(D e1) of $(D r1) with the -corresponding element $(D e2) in $(D r2). If $(D binaryFun!pred(e1, -e2)), $(D cmp) returns a negative value. If $(D binaryFun!pred(e2, -e1)), $(D cmp) returns a positive value. If one of the ranges has been -finished, $(D cmp) returns a negative value if $(D r1) has fewer -elements than $(D r2), a positive value if $(D r1) has more elements -than $(D r2), and $(D 0) if the ranges have the same number of +according to predicate `pred`. Iterating `r1` and `r2` in +lockstep, `cmp` compares each element `e1` of `r1` with the +corresponding element `e2` in `r2`. If $(D binaryFun!pred(e1, +e2)), `cmp` returns a negative value. If $(D binaryFun!pred(e2, +e1)), `cmp` returns a positive value. If one of the ranges has been +finished, `cmp` returns a negative value if `r1` has fewer +elements than `r2`, a positive value if `r1` has more elements +than `r2`, and `0` if the ranges have the same number of elements. -If the ranges are strings, $(D cmp) performs UTF decoding +If the ranges are strings, `cmp` performs UTF decoding appropriately and compares the ranges one code point at a time. */ int cmp(alias pred = "a < b", R1, R2)(R1 r1, R2 r2) @@ -670,17 +670,17 @@ int cmp(alias pred = "a < b", R1, R2)(R1 r1, R2 r2) if (isSomeString!R1 && isSom // equal /** -Compares two ranges for equality, as defined by predicate $(D pred) -(which is $(D ==) by default). +Compares two ranges for equality, as defined by predicate `pred` +(which is `==` by default). */ template equal(alias pred = "a == b") { /++ - Returns $(D true) if and only if the two ranges compare equal element - for element, according to binary predicate $(D pred). The ranges may + Returns `true` if and only if the two ranges compare equal element + for element, according to binary predicate `pred`. The ranges may have different element types, as long as $(D pred(a, b)) evaluates to - $(D bool) for $(D a) in $(D r1) and $(D b) in $(D r2). Performs - $(BIGOH min(r1.length, r2.length)) evaluations of $(D pred). + `bool` for `a` in `r1` and `b` in `r2`. Performs + $(BIGOH min(r1.length, r2.length)) evaluations of `pred`. See_Also: $(WEB sgi.com/tech/stl/_equal.html, STL's _equal) @@ -743,9 +743,9 @@ template equal(alias pred = "a == b") } /++ -Tip: $(D equal) can itself be used as a predicate to other functions. +Tip: `equal` can itself be used as a predicate to other functions. This can be very useful when the element type of a range is itself a -range. In particular, $(D equal) can be its own predicate, allowing +range. In particular, `equal` can be its own predicate, allowing range of range (of range...) comparisons. +/ @safe unittest @@ -847,10 +847,10 @@ private template MaxType(T...) /** Encodes $(WEB realityinteractive.com/rgrzywinski/archives/000249.html, edit operations) necessary to transform one sequence into -another. Given sequences $(D s) (source) and $(D t) (target), a -sequence of $(D EditOp) encodes the steps that need to be taken to -convert $(D s) into $(D t). For example, if $(D s = "cat") and $(D -"cars"), the minimal sequence that transforms $(D s) into $(D t) is: +another. Given sequences `s` (source) and `t` (target), a +sequence of `EditOp` encodes the steps that need to be taken to +convert `s` into `t`. For example, if $(D s = "cat") and $(D +"cars"), the minimal sequence that transforms `s` into `t` is: skip two characters, replace 't' with 'r', and insert an 's'. Working with edit operations is useful in applications such as spell-checkers (to find the closest word to a given misspelled word), approximate @@ -1074,9 +1074,9 @@ private: /** Returns the $(WEB wikipedia.org/wiki/Levenshtein_distance, Levenshtein -distance) between $(D s) and $(D t). The Levenshtein distance computes -the minimal amount of edit operations necessary to transform $(D s) -into $(D t). Performs $(BIGOH s.length * t.length) evaluations of $(D +distance) between `s` and `t`. The Levenshtein distance computes +the minimal amount of edit operations necessary to transform `s` +into `t`. Performs $(BIGOH s.length * t.length) evaluations of $(D equals) and occupies $(BIGOH s.length * t.length) storage. Allocates GC memory. @@ -1147,8 +1147,8 @@ size_t levenshteinDistance(alias equals = "a == b", Range1, Range2) } /** -Returns the Levenshtein distance and the edit path between $(D s) and -$(D t). +Returns the Levenshtein distance and the edit path between `s` and +`t`. Allocates GC memory. */ @@ -1353,11 +1353,11 @@ MinType!T min(T...)(T args) // mismatch /** -Sequentially compares elements in $(D r1) and $(D r2) in lockstep, and -stops at the first mismatch (according to $(D pred), by default +Sequentially compares elements in `r1` and `r2` in lockstep, and +stops at the first mismatch (according to `pred`, by default equality). Returns a tuple with the reduced ranges that start with the two mismatched values. Performs $(BIGOH min(r1.length, r2.length)) -evaluations of $(D pred). +evaluations of `pred`. See_Also: $(WEB sgi.com/tech/stl/_mismatch.html, STL's _mismatch) @@ -1399,9 +1399,9 @@ mismatch(alias pred = "a == b", Range1, Range2)(Range1 r1, Range2 r2) Returns one of a collection of expressions based on the value of the switch expression. -$(D choices) needs to be composed of pairs of test expressions and return -expressions. Each test-expression is compared with $(D switchExpression) using -$(D pred)($(D switchExpression) is the first argument) and if that yields true +`choices` needs to be composed of pairs of test expressions and return +expressions. Each test-expression is compared with `switchExpression` using +`pred`(`switchExpression` is the first argument) and if that yields true - the return expression is returned. Both the test and the return expressions are lazily evaluated. @@ -1423,7 +1423,7 @@ made the predicate yield true, or the default return expression if no test expression matched. Throws: If there is no default return expression and the predicate does not -yield true with any test expression - $(D SwitchError) is thrown. $(D +yield true with any test expression - `SwitchError` is thrown. $(D SwitchError) is also thrown if a void return expression was executed without throwing anything. */ diff --git a/std/algorithm/iteration.d b/std/algorithm/iteration.d index a94fcd78005..e310fd3b967 100644 --- a/std/algorithm/iteration.d +++ b/std/algorithm/iteration.d @@ -9,19 +9,19 @@ $(TR $(TH Function Name) $(TH Description)) $(T2 aggregate, $(D [[3, 1, 5], [2, 6, 4]].aggregate!max) returns a range containing - the elements $(D 5) and $(D 6).) + the elements `5` and `6`.) $(T2 cache, - Eagerly evaluates and caches another range's $(D front).) + Eagerly evaluates and caches another range's `front`.) $(T2 cacheBidirectional, - As above, but also provides $(D back) and $(D popBack).) + As above, but also provides `back` and `popBack`.) $(T2 each, - $(D each!writeln([1, 2, 3])) eagerly prints the numbers $(D 1), $(D 2) - and $(D 3) on their own lines.) + $(D each!writeln([1, 2, 3])) eagerly prints the numbers `1`, `2` + and `3` on their own lines.) $(T2 filter, - $(D filter!"a > 0"([1, -1, 2, 0, -3])) iterates over elements $(D 1) - and $(D 2).) + $(D filter!"a > 0"([1, -1, 2, 0, -3])) iterates over elements `1` + and `2`.) $(T2 filterBidirectional, - Similar to $(D filter), but also provides $(D back) and $(D popBack) at + Similar to `filter`, but also provides `back` and `popBack` at a small increase in cost.) $(T2 group, $(D group([5, 2, 2, 3, 3])) returns a range containing the tuples @@ -37,13 +37,13 @@ $(T2 joiner, the existing inputs are iterated.) $(T2 map, $(D map!"2 * a"([1, 2, 3])) lazily returns a range with the numbers - $(D 2), $(D 4), $(D 6).) + `2`, `4`, `6`.) $(T2 reduce, - $(D reduce!"a + b"([1, 2, 3, 4])) returns $(D 10).) + $(D reduce!"a + b"([1, 2, 3, 4])) returns `10`.) $(T2 splitter, Lazily splits a range by a separator.) $(T2 sum, - Same as $(D reduce), but specialized for accurate summation.) + Same as `reduce`, but specialized for accurate summation.) $(T2 uniq, Iterates over the unique elements in a range, which is assumed sorted.) ) @@ -113,28 +113,28 @@ template aggregate(fun...) if (fun.length >= 1) } /++ -$(D cache) eagerly evaluates $(D front) of $(D range) -on each construction or call to $(D popFront), +`cache` eagerly evaluates `front` of `range` +on each construction or call to `popFront`, to store the result in a cache. -The result is then directly returned when $(D front) is called, +The result is then directly returned when `front` is called, rather than re-evaluated. This can be a useful function to place in a chain, after functions that have expensive evaluation, as a lazy alternative to $(XREF array,array). -In particular, it can be placed after a call to $(D map), or before a call -to $(D filter). +In particular, it can be placed after a call to `map`, or before a call +to `filter`. -$(D cache) may provide bidirectional iteration if needed, but since +`cache` may provide bidirectional iteration if needed, but since this comes at an increased cost, it must be explicitly requested via the -call to $(D cacheBidirectional). Furthermore, a bidirectional cache will +call to `cacheBidirectional`. Furthermore, a bidirectional cache will evaluate the "center" element twice, when there is only one element left in the range. -$(D cache) does not provide random access primitives, -as $(D cache) would be unable to cache the random accesses. -If $(D Range) provides slicing primitives, -then $(D cache) will provide the same slicing primitives, -but $(D hasSlicing!Cache) will not yield true (as the $(XREF range,hasSlicing) +`cache` does not provide random access primitives, +as `cache` would be unable to cache the random accesses. +If `Range` provides slicing primitives, +then `cache` will provide the same slicing primitives, +but `hasSlicing!Cache` will not yield true (as the $(XREF range,hasSlicing) trait also checks for random access). +/ auto cache(Range)(Range range) @@ -193,14 +193,14 @@ if (isBidirectionalRange!Range) } /++ -Tip: $(D cache) is eager when evaluating elements. If calling front on the +Tip: `cache` is eager when evaluating elements. If calling front on the underlying range has a side effect, it will be observeable before calling front on the actual cached range. -Furtermore, care should be taken composing $(D cache) with $(XREF range,take). -By placing $(D take) before $(D cache), then $(D cache) will be "aware" +Furtermore, care should be taken composing `cache` with $(XREF range,take). +By placing `take` before `cache`, then `cache` will be "aware" of when the range ends, and correctly stop caching elements when needed. -If calling front has no side effect though, placing $(D take) after $(D cache) +If calling front has no side effect though, placing `take` after `cache` may yield a faster range. Either way, the resulting ranges will be equivalent, but maybe not at the @@ -421,10 +421,10 @@ private struct Cache(R, bool bidir) /** $(D auto map(Range)(Range r) if (isInputRange!(Unqual!Range));) -Implements the homonym function (also known as $(D transform)) present -in many languages of functional flavor. The call $(D map!(fun)(range)) -returns a range of which elements are obtained by applying $(D fun(a)) -left to right for all elements $(D a) in $(D range). The original ranges are +Implements the homonym function (also known as `transform`) present +in many languages of functional flavor. The call `map!(fun)(range)` +returns a range of which elements are obtained by applying `fun(a)` +left to right for all elements `a` in `range`. The original ranges are not changed. Evaluation is done lazily. See_Also: @@ -474,8 +474,8 @@ template map(fun...) if (fun.length >= 1) } /** -Multiple functions can be passed to $(D map). In that case, the -element type of $(D map) is a tuple containing one element for each +Multiple functions can be passed to `map`. In that case, the +element type of `map` is a tuple containing one element for each function. */ @safe unittest @@ -493,7 +493,7 @@ function. } /** -You may alias $(D map) with some function(s) to a symbol and use +You may alias `map` with some function(s) to a symbol and use it separately: */ @safe unittest @@ -784,7 +784,7 @@ unittest // each /** -Eagerly iterates over $(D r) and calls $(D pred) over _each element. +Eagerly iterates over `r` and calls `pred` over _each element. Params: pred = predicate to apply to each element of the range @@ -808,12 +808,12 @@ arr.each!((ref a) => a++); arr.each!"a++"; --- -If no predicate is specified, $(D each) will default to doing nothing -but consuming the entire range. $(D .front) will be evaluated, but this +If no predicate is specified, `each` will default to doing nothing +but consuming the entire range. `.front` will be evaluated, but this can be avoided by explicitly specifying a predicate lambda with a -$(D lazy) parameter. +`lazy` parameter. -$(D each) also supports $(D opApply)-based iterators, so it will work +`each` also supports `opApply`-based iterators, so it will work with e.g. $(XREF parallelism, parallel). See_Also: $(XREF range,tee) @@ -936,8 +936,8 @@ Params: range = Input range of elements Returns: - $(D filter!(predicate)(range)) returns a new range containing only elements $(D x) in $(D range) for - which $(D predicate(x)) returns $(D true). + `filter!(predicate)(range)` returns a new range containing only elements `x` in `range` for + which `predicate(x)` returns `true`. See_Also: $(WEB en.wikipedia.org/wiki/Filter_(higher-order_function), Filter (higher-order function)) @@ -1126,7 +1126,7 @@ private struct FilterResult(alias pred, Range) /** * $(D auto filterBidirectional(Range)(Range r) if (isBidirectionalRange!(Unqual!Range));) * - * Similar to $(D filter), except it defines a bidirectional + * Similar to `filter`, except it defines a bidirectional * range. There is a speed disadvantage - the constructor spends time * finding the last element in the range that satisfies the filtering * condition (in addition to finding the first one). The advantage is @@ -1291,10 +1291,10 @@ struct Group(alias pred, R) if (isInputRange!R) Groups consecutively equivalent elements into a single tuple of the element and the number of its repetitions. -Similarly to $(D uniq), $(D group) produces a range that iterates over unique +Similarly to `uniq`, `group` produces a range that iterates over unique consecutive elements of the given range. Each element of this range is a tuple of the element and the number of times it is repeated in the original range. -Equivalence of elements is assessed by using the predicate $(D pred), which +Equivalence of elements is assessed by using the predicate `pred`, which defaults to $(D "a == b"). Params: @@ -1303,7 +1303,7 @@ Params: Returns: A range of elements of type $(D Tuple!(ElementType!R, uint)), representing each consecutively unique element and its respective number of -occurrences in that run. This will be an input range if $(D R) is an input +occurrences in that run. This will be an input range if `R` is an input range, and a forward range in all other cases. */ Group!(pred, Range) group(alias pred = "a == b", Range)(Range r) @@ -1607,15 +1607,15 @@ unittest /** * Chunks an input range into subranges of equivalent adjacent elements. * - * Equivalence is defined by the predicate $(D pred), which can be either - * binary or unary. In the binary form, two _range elements $(D a) and $(D b) - * are considered equivalent if $(D pred(a,b)) is true. In unary form, two + * Equivalence is defined by the predicate `pred`, which can be either + * binary or unary. In the binary form, two _range elements `a` and `b` + * are considered equivalent if `pred(a,b)` is true. In unary form, two * elements are considered equivalent if $(D pred(a) == pred(b)) is true. * * This predicate must be an equivalence relation, that is, it must be - * reflexive ($(D pred(x,x)) is always true), symmetric + * reflexive (`pred(x,x)` is always true), symmetric * ($(D pred(x,y) == pred(y,x))), and transitive ($(D pred(x,y) && pred(y,z)) - * implies $(D pred(x,z))). If this is not the case, the range returned by + * implies `pred(x,z)`). If this is not the case, the range returned by * groupBy may assert at runtime or behave erratically. * * Params: @@ -1851,7 +1851,7 @@ Params: Returns: An input range of elements in the joined range. This will be a forward range if -both outer and inner ranges of $(D RoR) are forward ranges; otherwise it will +both outer and inner ranges of `RoR` are forward ranges; otherwise it will be only an input range. See_also: @@ -2377,18 +2377,18 @@ unittest } /++ -Implements the homonym function (also known as $(D accumulate), $(D -compress), $(D inject), or $(D foldl)) present in various programming +Implements the homonym function (also known as `accumulate`, $(D +compress), `inject`, or `foldl`) present in various programming languages of functional flavor. The call $(D reduce!(fun)(seed, -range)) first assigns $(D seed) to an internal variable $(D result), -also called the accumulator. Then, for each element $(D x) in $(D +range)) first assigns `seed` to an internal variable `result`, +also called the accumulator. Then, for each element `x` in $(D range), $(D result = fun(result, x)) gets evaluated. Finally, $(D -result) is returned. The one-argument version $(D reduce!(fun)(range)) +result) is returned. The one-argument version `reduce!(fun)(range)` works similarly, but it uses the first element of the range as the seed (the range must be non-empty). Returns: - the accumulated $(D result) + the accumulated `result` See_Also: $(WEB en.wikipedia.org/wiki/Fold_(higher-order_function), Fold (higher-order function)) @@ -2405,17 +2405,17 @@ template reduce(fun...) if (fun.length >= 1) import std.typecons : tuple, isTuple; /++ - No-seed version. The first element of $(D r) is used as the seed's value. + No-seed version. The first element of `r` is used as the seed's value. - For each function $(D f) in $(D fun), the corresponding - seed type $(D S) is $(D Unqual!(typeof(f(e, e)))), where $(D e) is an - element of $(D r): $(D ElementType!R) for ranges, - and $(D ForeachType!R) otherwise. + For each function `f` in `fun`, the corresponding + seed type `S` is $(D Unqual!(typeof(f(e, e)))), where `e` is an + element of `r`: `ElementType!R` for ranges, + and `ForeachType!R` otherwise. Once S has been determined, then $(D S s = e;) and $(D s = f(s, e);) must both be legal. - If $(D r) is empty, an $(D Exception) is thrown. + If `r` is empty, an `Exception` is thrown. +/ auto reduce(R)(R r) if (isIterable!R) @@ -2439,13 +2439,13 @@ template reduce(fun...) if (fun.length >= 1) } /++ - Seed version. The seed should be a single value if $(D fun) is a - single function. If $(D fun) is multiple functions, then $(D seed) - should be a $(XREF typecons,Tuple), with one field per function in $(D f). + Seed version. The seed should be a single value if `fun` is a + single function. If `fun` is multiple functions, then `seed` + should be a $(XREF typecons,Tuple), with one field per function in `f`. For convenience, if the seed is const, or has qualified fields, then - $(D reduce) will operate on an unqualified copy. If this happens - then the returned type will not perfectly match $(D S). + `reduce` will operate on an unqualified copy. If this happens + then the returned type will not perfectly match `S`. +/ auto reduce(S, R)(S seed, R r) if (isIterable!R) @@ -2520,8 +2520,8 @@ private template ReduceSeedType(E) } /** -Many aggregate range operations turn out to be solved with $(D reduce) -quickly and easily. The example below illustrates $(D reduce)'s +Many aggregate range operations turn out to be solved with `reduce` +quickly and easily. The example below illustrates `reduce`'s remarkable power and flexibility. */ @safe unittest @@ -2574,8 +2574,8 @@ remarkable power and flexibility. /** Sometimes it is very useful to compute multiple aggregates in one pass. One advantage is that the computation is faster because the looping overhead -is shared. That's why $(D reduce) accepts multiple functions. -If two or more functions are passed, $(D reduce) returns a +is shared. That's why `reduce` accepts multiple functions. +If two or more functions are passed, `reduce` returns a $(XREF typecons, Tuple) object with one member per passed-in function. The number of seeds must be correspondingly increased. */ @@ -2796,23 +2796,23 @@ element. If a range with one separator is given, the result is a range with two empty elements. If splitting a string on whitespace and token compression is desired, -consider using $(D splitter) without specifying a separator (see fourth overload +consider using `splitter` without specifying a separator (see fourth overload below). Params: pred = The predicate for comparing each element with the separator, defaulting to $(D "a == b"). r = The $(XREF2 range, isInputRange, input range) to be split. Must support - slicing and $(D .length). + slicing and `.length`. s = The element to be treated as the separator between range segments to be split. Constraints: - The predicate $(D pred) needs to accept an element of $(D r) and the - separator $(D s). + The predicate `pred` needs to accept an element of `r` and the + separator `s`. Returns: - An input range of the subranges of elements between separators. If $(D r) + An input range of the subranges of elements between separators. If `r` is a forward range or bidirectional range, the returned range will be likewise. @@ -3072,7 +3072,7 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool) } /** -Similar to the previous overload of $(D splitter), except this one uses another +Similar to the previous overload of `splitter`, except this one uses another range as a separator. This can be used with any narrow string type or sliceable range type, but is most popular with string types. @@ -3085,14 +3085,14 @@ Params: defaulting to $(D "a == b"). r = The $(XREF2 range, isInputRange, input range) to be split. s = The $(XREF2 range, isForwardRange, forward range) to be treated as the - separator between segments of $(D r) to be split. + separator between segments of `r` to be split. Constraints: - The predicate $(D pred) needs to accept an element of $(D r) and an - element of $(D s). + The predicate `pred` needs to accept an element of `r` and an + element of `s`. Returns: - An input range of the subranges of elements between separators. If $(D r) + An input range of the subranges of elements between separators. If `r` is a forward range or bidirectional range, the returned range will be likewise. @@ -3382,7 +3382,7 @@ if (is(typeof(binaryFun!pred(r.front, s.front)) : bool) /** -Similar to the previous overload of $(D splitter), except this one does not use a separator. +Similar to the previous overload of `splitter`, except this one does not use a separator. Instead, the predicate is an unary function on the input range's element type. Two adjacent separators are considered to surround an empty element in @@ -3394,10 +3394,10 @@ Params: input = The $(XREF2 range, isInputRange, input range) to be split. Constraints: - The predicate $(D isTerminator) needs to accept an element of $(D input). + The predicate `isTerminator` needs to accept an element of `input`. Returns: - An input range of the subranges of elements between separators. If $(D input) + An input range of the subranges of elements between separators. If `input` is a forward range or bidirectional range, the returned range will be likewise. @@ -3627,10 +3627,10 @@ private struct SplitterResult(alias isTerminator, Range) } /++ -Lazily splits the string $(D s) into words, using whitespace as the delimiter. +Lazily splits the string `s` into words, using whitespace as the delimiter. This function is string specific and, contrary to -$(D splitter!(std.uni.isWhite)), runs of whitespace will be merged together +`splitter!(std.uni.isWhite)`, runs of whitespace will be merged together (no empty tokens will be produced). Params: @@ -3819,32 +3819,32 @@ if (isSomeChar!C) // sum /** -Sums elements of $(D r), which must be a finite $(XREF2 range, isInputRange, input range). Although -conceptually $(D sum(r)) is equivalent to $(LREF reduce)!((a, b) => a + -b)(0, r), $(D sum) uses specialized algorithms to maximize accuracy, +Sums elements of `r`, which must be a finite $(XREF2 range, isInputRange, input range). Although +conceptually `sum(r)` is equivalent to $(LREF reduce)!((a, b) => a + +b)(0, r), `sum` uses specialized algorithms to maximize accuracy, as follows. $(UL -$(LI If $(D $(XREF range, ElementType)!R) is a floating-point type and $(D R) is a -$(XREF2 range, isRandomAccessRange, random-access range) with length and slicing, then $(D sum) uses the +$(LI If $(D $(XREF range, ElementType)!R) is a floating-point type and `R` is a +$(XREF2 range, isRandomAccessRange, random-access range) with length and slicing, then `sum` uses the $(WEB en.wikipedia.org/wiki/Pairwise_summation, pairwise summation) algorithm.) -$(LI If $(D ElementType!R) is a floating-point type and $(D R) is a +$(LI If `ElementType!R` is a floating-point type and `R` is a finite input range (but not a random-access range with slicing), then -$(D sum) uses the $(WEB en.wikipedia.org/wiki/Kahan_summation, +`sum` uses the $(WEB en.wikipedia.org/wiki/Kahan_summation, Kahan summation) algorithm.) $(LI In all other cases, a simple element by element addition is done.) ) -For floating point inputs, calculations are made in $(LINK2 ../type.html, $(D real)) -precision for $(D real) inputs and in $(D double) precision otherwise -(Note this is a special case that deviates from $(D reduce)'s behavior, -which would have kept $(D float) precision for a $(D float) range). +For floating point inputs, calculations are made in $(LINK2 ../type.html, `real`) +precision for `real` inputs and in `double` precision otherwise +(Note this is a special case that deviates from `reduce`'s behavior, +which would have kept `float` precision for a `float` range). For all other types, the calculations are done in the same type obtained from from adding two elements of the range, which may be a different type from the elements themselves (for example, in case of $(LINK2 ../type.html#integer-promotions, integral promotion)). -A seed may be passed to $(D sum). Not only will this seed be used as an initial +A seed may be passed to `sum`. Not only will this seed be used as an initial value, but its type will override all the above, and determine the algorithm and precision used for sumation. @@ -4014,8 +4014,8 @@ unittest Lazily iterates unique consecutive elements of the given range (functionality akin to the $(WEB wikipedia.org/wiki/_Uniq, _uniq) system utility). Equivalence of elements is assessed by using the predicate -$(D pred), by default $(D "a == b"). If the given range is -bidirectional, $(D uniq) also yields a bidirectional range. +`pred`, by default $(D "a == b"). If the given range is +bidirectional, `uniq` also yields a bidirectional range. Params: pred = Predicate for determining equivalence between range elements. @@ -4023,7 +4023,7 @@ Params: Returns: An $(XREF2 range, isInputRange, input range) of consecutively unique - elements in the original range. If $(D r) is also a forward range or + elements in the original range. If `r` is also a forward range or bidirectional range, the returned range will be likewise. */ auto uniq(alias pred = "a == b", Range)(Range r) diff --git a/std/algorithm/mutation.d b/std/algorithm/mutation.d index 7d06d1ea5e3..12894126d9c 100644 --- a/std/algorithm/mutation.d +++ b/std/algorithm/mutation.d @@ -21,10 +21,10 @@ $(T2 fill, leaves $(D a = [4, 4, 4]) and $(D fill(a, [3, 4])) leaves $(D a = [3, 4, 3]).) $(T2 initializeAll, - If $(D a = [1.2, 3.4]), then $(D initializeAll(a)) leaves + If $(D a = [1.2, 3.4]), then `initializeAll(a)` leaves $(D a = [double.init, double.init]).) $(T2 move, - $(D move(a, b)) moves $(D a) into $(D b). $(D move(a)) reads $(D a) + $(D move(a, b)) moves `a` into `b`. `move(a)` reads `a` destructively.) $(T2 moveAll, Moves all elements from one range to another.) @@ -34,12 +34,12 @@ $(T2 remove, Removes elements from a range in-place, and returns the shortened range.) $(T2 reverse, - If $(D a = [1, 2, 3]), $(D reverse(a)) changes it to $(D [3, 2, 1]).) + If $(D a = [1, 2, 3]), `reverse(a)` changes it to $(D [3, 2, 1]).) $(T2 strip, Strips all leading and trailing elements equal to a value, or that satisfy a predicate. If $(D a = [1, 1, 0, 1, 1]), then $(D strip(a, 1)) and - $(D strip!(e => e == 1)(a)) returns $(D [0]).) + $(D strip!(e => e == 1)(a)) returns `[0]`.) $(T2 stripLeft, Strips all leading elements equal to a value, or that satisfy a predicate. If $(D a = [1, 1, 0, 1, 1]), then $(D stripLeft(a, 1)) and @@ -80,25 +80,25 @@ import std.range; // bringToFront /** -The $(D bringToFront) function has considerable flexibility and +The `bringToFront` function has considerable flexibility and usefulness. It can rotate elements in one buffer left or right, swap buffers of equal length, and even move elements across disjoint buffers of different types and different lengths. -$(D bringToFront) takes two ranges $(D front) and $(D back), which may -be of different types. Considering the concatenation of $(D front) and -$(D back) one unified range, $(D bringToFront) rotates that unified -range such that all elements in $(D back) are brought to the beginning -of the unified range. The relative ordering of elements in $(D front) -and $(D back), respectively, remains unchanged. +`bringToFront` takes two ranges `front` and `back`, which may +be of different types. Considering the concatenation of `front` and +`back` one unified range, `bringToFront` rotates that unified +range such that all elements in `back` are brought to the beginning +of the unified range. The relative ordering of elements in `front` +and `back`, respectively, remains unchanged. Performs $(BIGOH max(front.length, back.length)) evaluations of $(D swap). Preconditions: -Either $(D front) and $(D back) are disjoint, or $(D back) is -reachable from $(D front) and $(D front) is not reachable from $(D +Either `front` and `back` are disjoint, or `back` is +reachable from `front` and `front` is not reachable from $(D back). Returns: @@ -171,7 +171,7 @@ size_t bringToFront(Range1, Range2)(Range1 front, Range2 back) } /** -The simplest use of $(D bringToFront) is for rotating elements in a +The simplest use of `bringToFront` is for rotating elements in a buffer. For example: */ @safe unittest @@ -183,10 +183,10 @@ buffer. For example: } /** -The $(D front) range may actually "step over" the $(D back) +The `front` range may actually "step over" the `back` range. This is very useful with forward ranges that cannot compute comfortably right-bounded subranges like $(D arr[0 .. 4]) above. In -the example below, $(D r2) is a right subrange of $(D r1). +the example below, `r2` is a right subrange of `r1`. */ @safe unittest { @@ -285,11 +285,11 @@ Elements can be swapped across ranges of different types: // copy /** -Copies the content of $(D source) into $(D target) and returns the -remaining (unfilled) part of $(D target). +Copies the content of `source` into `target` and returns the +remaining (unfilled) part of `target`. -Preconditions: $(D target) shall have enough room to accomodate -$(D source). +Preconditions: `target` shall have enough room to accomodate +`source`. See_Also: $(WEB sgi.com/tech/stl/_copy.html, STL's _copy) @@ -374,7 +374,7 @@ range elements, different types of ranges are accepted: } /** -To _copy at most $(D n) elements from a range, you may want to use +To _copy at most `n` elements from a range, you may want to use $(XREF range, take): */ @safe unittest @@ -444,7 +444,7 @@ $(WEB sgi.com/tech/stl/copy_backward.html, STL's copy_backward'): } /** -Assigns $(D value) to each element of input range $(D range). +Assigns `value` to each element of input range `range`. Params: range = An $(XREF2 range, isInputRange, input range) that exposes references to its elements @@ -553,9 +553,9 @@ void fill(Range, Value)(Range range, Value value) } /** -Fills $(D range) with a pattern copied from $(D filler). The length of -$(D range) does not have to be a multiple of the length of $(D -filler). If $(D filler) is empty, an exception is thrown. +Fills `range` with a pattern copied from `filler`. The length of +`range` does not have to be a multiple of the length of $(D +filler). If `filler` is empty, an exception is thrown. Params: range = An $(XREF2 range, isInputRange, input range) that exposes @@ -674,7 +674,7 @@ void fill(Range1, Range2)(Range1 range, Range2 filler) } /** -Initializes all elements of $(D range) with their $(D .init) value. +Initializes all elements of `range` with their `.init` value. Assumes that the elements of the range are uninitialized. Params: @@ -819,11 +819,11 @@ unittest // move /** -Moves $(D source) into $(D target) via a destructive copy. +Moves `source` into `target` via a destructive copy. Params: source = Data to copy. If a destructor or postblit is defined, it is reset - to its $(D .init) value after it is moved into target. Note that data + to its `.init` value after it is moved into target. Note that data with internal pointers that point to itself cannot be moved, and will trigger an assertion failure. target = Where to copy into. The destructor, if any, is invoked before the @@ -1115,20 +1115,20 @@ unittest// Issue 8057 // moveAll /** -For each element $(D a) in $(D src) and each element $(D b) in $(D +For each element `a` in `src` and each element `b` in $(D tgt) in lockstep in increasing order, calls $(D move(a, b)). Preconditions: $(D walkLength(src) <= walkLength(tgt)). An exception will be thrown if this condition does not hold, i.e., there is not -enough room in $(D tgt) to accommodate all of $(D src). +enough room in `tgt` to accommodate all of `src`. Params: src = An $(XREF2 range, isInputRange, input range) with movable elements. tgt = An $(XREF2 range, isInputRange, input range) with elements that - elements from $(D src) can be moved into. + elements from `src` can be moved into. -Returns: The leftover portion of $(D tgt) after all elements from $(D src) have +Returns: The leftover portion of `tgt` after all elements from `src` have been moved. */ Range2 moveAll(Range1, Range2)(Range1 src, Range2 tgt) @@ -1170,14 +1170,14 @@ unittest // moveSome /** -For each element $(D a) in $(D src) and each element $(D b) in $(D +For each element `a` in `src` and each element `b` in $(D tgt) in lockstep in increasing order, calls $(D move(a, b)). Stops -when either $(D src) or $(D tgt) have been exhausted. +when either `src` or `tgt` have been exhausted. Params: src = An $(XREF2 range, isInputRange, input range) with movable elements. tgt = An $(XREF2 range, isInputRange, input range) with elements that - elements from $(D src) can be moved into. + elements from `src` can be moved into. Returns: The leftover portions of the two ranges after one or the other of the ranges have been exhausted. @@ -1214,8 +1214,8 @@ elements in a range (such as partition and sort). The strategy concerns the swapping of elements that are not the core concern of the algorithm. For example, consider an algorithm that sorts $(D [ "abc", "b", "aBc" ]) according to $(D toUpper(a) < toUpper(b)). That -algorithm might choose to swap the two equivalent strings $(D "abc") -and $(D "aBc"). That does not affect the sorting since both $(D [ +algorithm might choose to swap the two equivalent strings `"abc"` +and `"aBc"`. That does not affect the sorting since both $(D [ "abc", "aBc", "b" ]) and $(D [ "aBc", "abc", "b" ]) are valid outcomes. @@ -1231,12 +1231,12 @@ being stable only on a well-defined subrange of the range. There is no established terminology for such behavior; this library calls it $(B semistable). -Generally, the $(D stable) ordering strategy may be more costly in +Generally, the `stable` ordering strategy may be more costly in time and/or space than the other two because it imposes additional -constraints. Similarly, $(D semistable) may be costlier than $(D +constraints. Similarly, `semistable` may be costlier than $(D unstable). As (semi-)stability is not needed very often, the ordering -algorithms in this module parameterized by $(D SwapStrategy) all -choose $(D SwapStrategy.unstable) as the default. +algorithms in this module parameterized by `SwapStrategy` all +choose `SwapStrategy.unstable` as the default. */ enum SwapStrategy @@ -1259,7 +1259,7 @@ enum SwapStrategy } /** -Eliminates elements at given offsets from $(D range) and returns the +Eliminates elements at given offsets from `range` and returns the shortened range. In the simplest call, one element is removed. ---- @@ -1268,17 +1268,17 @@ assert(remove(a, 1) == [ 3, 7, 8 ]); assert(a == [ 3, 7, 8, 8 ]); ---- -In the case above the element at offset $(D 1) is removed and $(D +In the case above the element at offset `1` is removed and $(D remove) returns the range smaller by one element. The original array has remained of the same length because all functions in $(D std.algorithm) only change $(I content), not $(I topology). The value -$(D 8) is repeated because $(XREF algorithm, move) was invoked to move -elements around and on integers $(D move) simply copies the source to -the destination. To replace $(D a) with the effect of the removal, +`8` is repeated because $(XREF algorithm, move) was invoked to move +elements around and on integers `move` simply copies the source to +the destination. To replace `a` with the effect of the removal, simply assign $(D a = remove(a, 1)). The slice will be rebound to the shorter array and the operation completes with maximal efficiency. -Multiple indices can be passed into $(D remove). In that case, +Multiple indices can be passed into `remove`. In that case, elements at the respective indices are all removed. The indices must be passed in increasing order, otherwise an exception occurs. @@ -1301,24 +1301,24 @@ assert(remove(a, 1, tuple(3, 5), 9) == [ 0, 2, 6, 7, 8, 10 ]); In this case, the slots at positions 1, 3, 4, and 9 are removed from the array. The tuple passes in a range closed to the left and open to the right (consistent with built-in slices), e.g. $(D tuple(3, 5)) -means indices $(D 3) and $(D 4) but not $(D 5). +means indices `3` and `4` but not `5`. If the need is to remove some elements in the range but the order of the remaining elements does not have to be preserved, you may want to -pass $(D SwapStrategy.unstable) to $(D remove). +pass `SwapStrategy.unstable` to `remove`. ---- int[] a = [ 0, 1, 2, 3 ]; assert(remove!(SwapStrategy.unstable)(a, 1) == [ 0, 3, 2 ]); ---- -In the case above, the element at slot $(D 1) is removed, but replaced +In the case above, the element at slot `1` is removed, but replaced with the last element of the range. Taking advantage of the relaxation -of the stability requirement, $(D remove) moved elements from the end +of the stability requirement, `remove` moved elements from the end of the array over the slots to be removed. This way there is less data movement to be done which improves the execution time of the function. -The function $(D remove) works on any forward range. The moving +The function `remove` works on any forward range. The moving strategy is (listed from fastest to slowest): $(UL $(LI If $(D s == SwapStrategy.unstable && isRandomAccessRange!Range && hasLength!Range && hasLvalueElements!Range), then elements are moved from the end @@ -1327,8 +1327,8 @@ minimum of moves is performed.) $(LI Otherwise, if $(D s == SwapStrategy.unstable && isBidirectionalRange!Range && hasLength!Range && hasLvalueElements!Range), then elements are still moved from the end of the range, but time is spent on advancing between slots by repeated -calls to $(D range.popFront).) $(LI Otherwise, elements are moved -incrementally towards the front of $(D range); a given element is never +calls to `range.popFront`.) $(LI Otherwise, elements are moved +incrementally towards the front of `range`; a given element is never moved several times, but more elements are moved than in the previous cases.)) */ @@ -1546,8 +1546,8 @@ if (s == SwapStrategy.stable } /** -Reduces the length of the bidirectional range $(D range) by removing -elements that satisfy $(D pred). If $(D s = SwapStrategy.unstable), +Reduces the length of the bidirectional range `range` by removing +elements that satisfy `pred`. If $(D s = SwapStrategy.unstable), elements are moved from the right end of the range over the elements to eliminate. If $(D s = SwapStrategy.stable) (the default), elements are moved progressively to front such that their relative @@ -1627,7 +1627,7 @@ if (isBidirectionalRange!Range // reverse /** -Reverses $(D r) in-place. Performs $(D r.length / 2) evaluations of $(D +Reverses `r` in-place. Performs $(D r.length / 2) evaluations of $(D swap). See_Also: @@ -1685,8 +1685,8 @@ if (isRandomAccessRange!Range && hasLength!Range) } /** -Reverses $(D r) in-place, where $(D r) is a narrow string (having -elements of type $(D char) or $(D wchar)). UTF sequences consisting of +Reverses `r` in-place, where `r` is a narrow string (having +elements of type `char` or `wchar`). UTF sequences consisting of multiple code units are preserved properly. */ void reverse(Char)(Char[] s) @@ -1760,12 +1760,12 @@ void swapAt(R)(R r, size_t i1, size_t i2) The strip group of functions allow stripping of either leading, trailing, or both leading and trailing elements. - The $(D stripLeft) function will strip the $(D front) of the range, - the $(D stripRight) function will strip the $(D back) of the range, - while the $(D strip) function will strip both the $(D front) and $(D back) + The `stripLeft` function will strip the `front` of the range, + the `stripRight` function will strip the `back` of the range, + while the `strip` function will strip both the `front` and `back` of the range. - Note that the $(D strip) and $(D stripRight) functions require the range to + Note that the `strip` and `stripRight` functions require the range to be a $(LREF BidirectionalRange) range. All of these functions come in two varieties: one takes a target element, @@ -1890,18 +1890,18 @@ Range stripRight(alias pred, Range)(Range range) // swap /** -Swaps $(D lhs) and $(D rhs). The instances $(D lhs) and $(D rhs) are moved in -memory, without ever calling $(D opAssign), nor any other function. $(D T) +Swaps `lhs` and `rhs`. The instances `lhs` and `rhs` are moved in +memory, without ever calling `opAssign`, nor any other function. `T` need not be assignable at all to be swapped. -If $(D lhs) and $(D rhs) reference the same instance, then nothing is done. +If `lhs` and `rhs` reference the same instance, then nothing is done. -$(D lhs) and $(D rhs) must be mutable. If $(D T) is a struct or union, then +`lhs` and `rhs` must be mutable. If `T` is a struct or union, then its fields must also all be (recursively) mutable. Params: - lhs = Data to be swapped with $(D rhs). - rhs = Data to be swapped with $(D lhs). + lhs = Data to be swapped with `rhs`. + rhs = Data to be swapped with `lhs`. */ void swap(T)(ref T lhs, ref T rhs) @trusted pure nothrow @nogc if (isBlitAssignable!T && !is(typeof(lhs.proxySwap(rhs)))) @@ -2128,8 +2128,8 @@ void swapFront(R1, R2)(R1 r1, R2 r2) // swapRanges /** -Swaps all elements of $(D r1) with successive elements in $(D r2). -Returns a tuple containing the remainder portions of $(D r1) and $(D +Swaps all elements of `r1` with successive elements in `r2`. +Returns a tuple containing the remainder portions of `r1` and $(D r2) that were not swapped (one of them will be empty). The ranges may be of different types but must have the same element type and support swapping. @@ -2159,7 +2159,7 @@ swapRanges(Range1, Range2)(Range1 r1, Range2 r2) } /** -Initializes each element of $(D range) with $(D value). +Initializes each element of `range` with `value`. Assumes that the elements of the range are uninitialized. This is of interest for structs that define copy constructors (for all other types, $(LREF fill) and diff --git a/std/algorithm/package.d b/std/algorithm/package.d index bc40de35a1b..a0a4fce0140 100644 --- a/std/algorithm/package.d +++ b/std/algorithm/package.d @@ -139,8 +139,8 @@ Many functions in this package are parameterized with a function or a $(GLOSSARY predicate). The predicate may be passed either as a function name, a delegate name, a $(GLOSSARY functor) name, or a compile-time string. The string may consist of $(B any) legal D -expression that uses the symbol $(D a) (for unary functions) or the -symbols $(D a) and $(D b) (for binary functions). These names will NOT +expression that uses the symbol `a` (for unary functions) or the +symbols `a` and `b` (for binary functions). These names will NOT interfere with other homonym symbols in user code because they are evaluated in a different context. The default for all binary comparison predicates is $(D "a == b") for unordered operations and diff --git a/std/algorithm/searching.d b/std/algorithm/searching.d index e36de1d2cf6..6e65772f21e 100644 --- a/std/algorithm/searching.d +++ b/std/algorithm/searching.d @@ -8,53 +8,53 @@ $(BOOKTABLE Cheat Sheet, $(TR $(TH Function Name) $(TH Description)) $(T2 all, - $(D all!"a > 0"([1, 2, 3, 4])) returns $(D true) because all elements + $(D all!"a > 0"([1, 2, 3, 4])) returns `true` because all elements are positive) $(T2 any, - $(D any!"a > 0"([1, 2, -3, -4])) returns $(D true) because at least one + $(D any!"a > 0"([1, 2, -3, -4])) returns `true` because at least one element is positive) $(T2 balancedParens, - $(D balancedParens("((1 + 1) / 2)")) returns $(D true) because the + $(D balancedParens("((1 + 1) / 2)")) returns `true` because the string has balanced parentheses.) $(T2 boyerMooreFinder, - $(D find("hello world", boyerMooreFinder("or"))) returns $(D "orld") + $(D find("hello world", boyerMooreFinder("or"))) returns `"orld"` using the $(LUCKY Boyer-Moore _algorithm).) $(T2 canFind, - $(D canFind("hello world", "or")) returns $(D true).) + $(D canFind("hello world", "or")) returns `true`.) $(T2 count, Counts elements that are equal to a specified value or satisfy a - predicate. $(D count([1, 2, 1], 1)) returns $(D 2) and - $(D count!"a < 0"([1, -3, 0])) returns $(D 1).) + predicate. $(D count([1, 2, 1], 1)) returns `2` and + $(D count!"a < 0"([1, -3, 0])) returns `1`.) $(T2 countUntil, - $(D countUntil(a, b)) returns the number of steps taken in $(D a) to - reach $(D b); for example, $(D countUntil("hello!", "o")) returns - $(D 4).) + $(D countUntil(a, b)) returns the number of steps taken in `a` to + reach `b`; for example, $(D countUntil("hello!", "o")) returns + `4`.) $(T2 commonPrefix, - $(D commonPrefix("parakeet", "parachute")) returns $(D "para").) + $(D commonPrefix("parakeet", "parachute")) returns `"para"`.) $(T2 endsWith, - $(D endsWith("rocks", "ks")) returns $(D true).) + $(D endsWith("rocks", "ks")) returns `true`.) $(T2 find, - $(D find("hello world", "or")) returns $(D "orld") using linear search. + $(D find("hello world", "or")) returns `"orld"` using linear search. (For binary search refer to $(XREF range,sortedRange).)) $(T2 findAdjacent, $(D findAdjacent([1, 2, 3, 3, 4])) returns the subrange starting with two equal adjacent elements, i.e. $(D [3, 3, 4]).) $(T2 findAmong, - $(D findAmong("abcd", "qcx")) returns $(D "cd") because $(D 'c') is - among $(D "qcx").) + $(D findAmong("abcd", "qcx")) returns `"cd"` because `'c'` is + among `"qcx"`.) $(T2 findSkip, - If $(D a = "abcde"), then $(D findSkip(a, "x")) returns $(D false) and - leaves $(D a) unchanged, whereas $(D findSkip(a, 'c')) advances $(D a) - to $(D "cde") and returns $(D true).) + If $(D a = "abcde"), then $(D findSkip(a, "x")) returns `false` and + leaves `a` unchanged, whereas $(D findSkip(a, 'c')) advances `a` + to `"cde"` and returns `true`.) $(T2 findSplit, - $(D findSplit("abcdefg", "de")) returns the three ranges $(D "abc"), - $(D "de"), and $(D "fg").) + $(D findSplit("abcdefg", "de")) returns the three ranges `"abc"`, + `"de"`, and `"fg"`.) $(T2 findSplitAfter, $(D findSplitAfter("abcdefg", "de")) returns the two ranges - $(D "abcde") and $(D "fg").) + `"abcde"` and `"fg"`.) $(T2 findSplitBefore, - $(D findSplitBefore("abcdefg", "de")) returns the two ranges $(D "abc") - and $(D "defg").) + $(D findSplitBefore("abcdefg", "de")) returns the two ranges `"abc"` + and `"defg"`.) $(T2 minCount, $(D minCount([2, 1, 1, 4, 1])) returns $(D tuple(1, 3)).) $(T2 minPos, @@ -63,13 +63,13 @@ $(T2 minPos, element.) $(T2 mismatch, $(D mismatch("parakeet", "parachute")) returns the two ranges - $(D "keet") and $(D "chute").) + `"keet"` and `"chute"`.) $(T2 skipOver, - Assume $(D a = "blah"). Then $(D skipOver(a, "bi")) leaves $(D a) - unchanged and returns $(D false), whereas $(D skipOver(a, "bl")) - advances $(D a) to refer to $(D "ah") and returns $(D true).) + Assume $(D a = "blah"). Then $(D skipOver(a, "bi")) leaves `a` + unchanged and returns `false`, whereas $(D skipOver(a, "bl")) + advances `a` to refer to `"ah"` and returns `true`.) $(T2 startsWith, - $(D startsWith("hello, world", "hello")) returns $(D true).) + $(D startsWith("hello, world", "hello")) returns `true`.) $(T2 until, Lazily iterates a range until a specific value is found.) ) @@ -95,14 +95,14 @@ import std.traits; import std.typecons; // : Tuple; /++ -Checks if $(I _all) of the elements verify $(D pred). +Checks if $(I _all) of the elements verify `pred`. +/ template all(alias pred = "a") { /++ - Returns $(D true) if and only if $(I _all) values $(D v) found in the - input range $(D range) satisfy the predicate $(D pred). - Performs (at most) $(BIGOH range.length) evaluations of $(D pred). + Returns `true` if and only if $(I _all) values `v` found in the + input range `range` satisfy the predicate `pred`. + Performs (at most) $(BIGOH range.length) evaluations of `pred`. +/ bool all(Range)(Range range) if (isInputRange!Range && is(typeof(unaryFun!pred(range.front)))) @@ -121,7 +121,7 @@ template all(alias pred = "a") } /++ -$(D all) can also be used without a predicate, if its items can be +`all` can also be used without a predicate, if its items can be evaluated to true or false in a conditional statement. This can be a convenient way to quickly evaluate that $(I _all) of the elements of a range are true. @@ -139,16 +139,16 @@ are true. } /++ -Checks if $(I _any) of the elements verifies $(D pred). -$(D !any) can be used to verify that $(I none) of the elements verify -$(D pred). +Checks if $(I _any) of the elements verifies `pred`. +`!any` can be used to verify that $(I none) of the elements verify +`pred`. +/ template any(alias pred = "a") { /++ - Returns $(D true) if and only if $(I _any) value $(D v) found in the - input range $(D range) satisfies the predicate $(D pred). - Performs (at most) $(BIGOH range.length) evaluations of $(D pred). + Returns `true` if and only if $(I _any) value `v` found in the + input range `range` satisfies the predicate `pred`. + Performs (at most) $(BIGOH range.length) evaluations of `pred`. +/ bool any(Range)(Range range) if (isInputRange!Range && is(typeof(unaryFun!pred(range.front)))) @@ -166,8 +166,8 @@ template any(alias pred = "a") } /++ -$(D any) can also be used without a predicate, if its items can be -evaluated to true or false in a conditional statement. $(D !any) can be a +`any` can also be used without a predicate, if its items can be +evaluated to true or false in a conditional statement. `!any` can be a convenient way to quickly test that $(I none) of the elements of a range evaluate to true. +/ @@ -195,10 +195,10 @@ evaluate to true. // balancedParens /** -Checks whether $(D r) has "balanced parentheses", i.e. all instances -of $(D lPar) are closed by corresponding instances of $(D rPar). The -parameter $(D maxNestingLevel) controls the nesting level allowed. The -most common uses are the default or $(D 0). In the latter case, no +Checks whether `r` has "balanced parentheses", i.e. all instances +of `lPar` are closed by corresponding instances of `rPar`. The +parameter `maxNestingLevel` controls the nesting level allowed. The +most common uses are the default or `0`. In the latter case, no nesting is allowed. */ bool balancedParens(Range, E)(Range r, E lPar, E rPar, @@ -236,18 +236,18 @@ if (isInputRange!(Range) && is(typeof(r.front == lPar))) } /** - * Sets up Boyer-Moore matching for use with $(D find) below. + * Sets up Boyer-Moore matching for use with `find` below. * By default, elements are compared for equality. * - * $(D BoyerMooreFinder) allocates GC memory. + * `BoyerMooreFinder` allocates GC memory. * * Params: * pred = Predicate used to compare elements. * needle = A random-access range with length and slicing. * * Returns: - * An instance of $(D BoyerMooreFinder) that can be used with $(D find()) to - * invoke the Boyer-Moore matching algorithm for finding of $(D needle) in a + * An instance of `BoyerMooreFinder` that can be used with `find()` to + * invoke the Boyer-Moore matching algorithm for finding of `needle` in a * given haystack. */ BoyerMooreFinder!(binaryFun!(pred), Range) boyerMooreFinder @@ -366,9 +366,9 @@ Params: r2 = An $(XREF2 range, isInputRange, input range) of elements. Returns: -A slice of $(D r1) which contains the characters that both ranges start with, +A slice of `r1` which contains the characters that both ranges start with, if the first argument is a string; otherwise, the same as the result of -$(D takeExactly(r1, n)), where $(D n) is the number of elements in the common +$(D takeExactly(r1, n)), where `n` is the number of elements in the common prefix of both ranges. See_Also: @@ -541,21 +541,21 @@ if (isNarrowString!R1 && isNarrowString!R2) // count /** -The first version counts the number of elements $(D x) in $(D r) for -which $(D pred(x, value)) is $(D true). $(D pred) defaults to -equality. Performs $(BIGOH haystack.length) evaluations of $(D pred). +The first version counts the number of elements `x` in `r` for +which $(D pred(x, value)) is `true`. `pred` defaults to +equality. Performs $(BIGOH haystack.length) evaluations of `pred`. -The second version returns the number of times $(D needle) occurs in -$(D haystack). Throws an exception if $(D needle.empty), as the _count +The second version returns the number of times `needle` occurs in +`haystack`. Throws an exception if `needle.empty`, as the _count of the empty range in any range would be infinite. Overlapped counts -are not considered, for example $(D count("aaa", "aa")) is $(D 1), not -$(D 2). +are not considered, for example $(D count("aaa", "aa")) is `1`, not +`2`. -The third version counts the elements for which $(D pred(x)) is $(D -true). Performs $(BIGOH haystack.length) evaluations of $(D pred). +The third version counts the elements for which `pred(x)` is $(D +true). Performs $(BIGOH haystack.length) evaluations of `pred`. -Note: Regardless of the overload, $(D count) will not accept -infinite ranges for $(D haystack). +Note: Regardless of the overload, `count` will not accept +infinite ranges for `haystack`. */ size_t count(alias pred = "a == b", Range, E)(Range haystack, E needle) if (isInputRange!Range && !isInfinite!Range && @@ -666,20 +666,20 @@ size_t count(alias pred = "true", R)(R haystack) /++ Counts elements in the given $(XREF2 range, isForwardRange, forward range) - until the given predicate is true for one of the given $(D needles). + until the given predicate is true for one of the given `needles`. Params: pred = The predicate for determining when to stop counting. haystack = The $(XREF2 range, isInputRange, input range) to be counted. needles = Either a single element, or a $(XREF2 range, isForwardRange, forward range) of elements, to be evaluated in turn against each - element in $(D haystack) under the given predicate. + element in `haystack` under the given predicate. Returns: The number of elements which must be popped from the front of - $(D haystack) before reaching an element for which - $(D startsWith!pred(haystack, needles)) is $(D true). If - $(D startsWith!pred(haystack, needles)) is not $(D true) for any element in - $(D haystack), then $(D -1) is returned. + `haystack` before reaching an element for which + $(D startsWith!pred(haystack, needles)) is `true`. If + $(D startsWith!pred(haystack, needles)) is not `true` for any element in + `haystack`, then `-1` is returned. +/ ptrdiff_t countUntil(alias pred = "a == b", R, Rs...)(R haystack, Rs needles) if (isForwardRange!R @@ -828,15 +828,15 @@ ptrdiff_t countUntil(alias pred = "a == b", R, N)(R haystack, N needle) } /++ - Similar to the previous overload of $(D countUntil), except that this one - evaluates only the predicate $(D pred). + Similar to the previous overload of `countUntil`, except that this one + evaluates only the predicate `pred`. Params: pred = Predicate to when to stop counting. haystack = An $(XREF2 range, isInputRange, input range) of elements to be counted. - Returns: The number of elements which must be popped from $(D haystack) - before $(D pred(haystack.front)) is $(D true). + Returns: The number of elements which must be popped from `haystack` + before `pred(haystack.front)` is `true`. +/ ptrdiff_t countUntil(alias pred, R)(R haystack) if (isInputRange!R && @@ -923,7 +923,7 @@ ptrdiff_t countUntil(alias pred, R)(R haystack) /** Checks if the given range ends with (one of) the given needle(s). -The reciprocal of $(D startsWith). +The reciprocal of `startsWith`. Params: pred = The predicate to use for comparing elements between the range and @@ -940,7 +940,7 @@ Params: Returns: 0 if the needle(s) do not occur at the end of the given range; otherwise the position of the matching needle, that is, 1 if the range ends -with $(D withOneOfThese[0]), 2 if it ends with $(D withOneOfThese[1]), and so +with `withOneOfThese[0]`, 2 if it ends with `withOneOfThese[1]`, and so on. */ uint endsWith(alias pred = "a == b", Range, Needles...)(Range doesThisEnd, Needles withOneOfThese) @@ -1151,11 +1151,11 @@ if (isBidirectionalRange!R && // find /** Finds an individual element in an input range. Elements of $(D -haystack) are compared with $(D needle) by using predicate $(D +haystack) are compared with `needle` by using predicate $(D pred). Performs $(BIGOH walkLength(haystack)) evaluations of $(D pred). -To _find the last occurrence of $(D needle) in $(D haystack), call $(D +To _find the last occurrence of `needle` in `haystack`, call $(D find(retro(haystack), needle)). See $(XREF range, retro). Params: @@ -1176,9 +1176,9 @@ $(D isInputRange!InputRange && is(typeof(binaryFun!pred(haystack.front, needle) Returns: -$(D haystack) advanced such that the front element is the one searched for; -that is, until $(D binaryFun!pred(haystack.front, needle)) is $(D true). If no -such position exists, returns an empty $(D haystack). +`haystack` advanced such that the front element is the one searched for; +that is, until $(D binaryFun!pred(haystack.front, needle)) is `true`. If no +such position exists, returns an empty `haystack`. See_Also: $(WEB sgi.com/tech/stl/_find.html, STL's _find) @@ -1442,13 +1442,13 @@ if (isInputRange!InputRange && } /** -Advances the input range $(D haystack) by calling $(D haystack.popFront) -until either $(D pred(haystack.front)), or $(D +Advances the input range `haystack` by calling `haystack.popFront` +until either `pred(haystack.front)`, or $(D haystack.empty). Performs $(BIGOH haystack.length) evaluations of $(D pred). -To _find the last element of a bidirectional $(D haystack) satisfying -$(D pred), call $(D find!(pred)(retro(haystack))). See $(XREF +To _find the last element of a bidirectional `haystack` satisfying +`pred`, call $(D find!(pred)(retro(haystack))). See $(XREF range, retro). Params: @@ -1460,9 +1460,9 @@ haystack = The $(XREF2 range, isInputRange, input range) to search in. Returns: -$(D haystack) advanced such that the front element is the one searched for; -that is, until $(D binaryFun!pred(haystack.front, needle)) is $(D true). If no -such position exists, returns an empty $(D haystack). +`haystack` advanced such that the front element is the one searched for; +that is, until $(D binaryFun!pred(haystack.front, needle)) is `true`. If no +such position exists, returns an empty `haystack`. See_Also: $(WEB sgi.com/tech/stl/find_if.html, STL's find_if) @@ -1551,8 +1551,8 @@ needle = The $(XREF2 range, isForwardRange, forward range) searched for. Returns: -$(D haystack) advanced such that $(D needle) is a prefix of it (if no -such position exists, returns $(D haystack) advanced to termination). +`haystack` advanced such that `needle` is a prefix of it (if no +such position exists, returns `haystack` advanced to termination). */ R1 find(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && isForwardRange!R2 @@ -1874,7 +1874,7 @@ if (isRandomAccessRange!R1 && isForwardRange!R2 && !isBidirectionalRange!R2 && } /** -Finds two or more $(D needles) into a $(D haystack). The predicate $(D +Finds two or more `needles` into a `haystack`. The predicate $(D pred) is used throughout to compare elements. By default, elements are compared for equality. @@ -1883,40 +1883,40 @@ Params: pred = The predicate to use for comparing elements. haystack = The target of the search. Must be an input range. -If any of $(D needles) is a range with elements comparable to -elements in $(D haystack), then $(D haystack) must be a forward range +If any of `needles` is a range with elements comparable to +elements in `haystack`, then `haystack` must be a forward range such that the search can backtrack. -needles = One or more items to search for. Each of $(D needles) must -be either comparable to one element in $(D haystack), or be itself a +needles = One or more items to search for. Each of `needles` must +be either comparable to one element in `haystack`, or be itself a forward range with elements comparable with elements in -$(D haystack). +`haystack`. Returns: -A tuple containing $(D haystack) positioned to match one of the +A tuple containing `haystack` positioned to match one of the needles and also the 1-based index of the matching element in $(D -needles) (0 if none of $(D needles) matched, 1 if $(D needles[0]) -matched, 2 if $(D needles[1]) matched...). The first needle to be found +needles) (0 if none of `needles` matched, 1 if `needles[0]` +matched, 2 if `needles[1]` matched...). The first needle to be found will be the one that matches. If multiple needles are found at the same spot in the range, then the shortest one is the one which matches (if multiple needles of the same length are found at the same spot (e.g -$(D "a") and $(D 'a')), then the left-most of them in the argument list +`"a"` and `'a'`), then the left-most of them in the argument list matches). -The relationship between $(D haystack) and $(D needles) simply means -that one can e.g. search for individual $(D int)s or arrays of $(D -int)s in an array of $(D int)s. In addition, if elements are +The relationship between `haystack` and `needles` simply means +that one can e.g. search for individual `int`s or arrays of $(D +int)s in an array of `int`s. In addition, if elements are individually comparable, searches of heterogeneous types are allowed -as well: a $(D double[]) can be searched for an $(D int) or a $(D -short[]), and conversely a $(D long) can be searched for a $(D float) -or a $(D double[]). This makes for efficient searches without the need +as well: a `double[]` can be searched for an `int` or a $(D +short[]), and conversely a `long` can be searched for a `float` +or a `double[]`. This makes for efficient searches without the need to coerce one side of the comparison into the other's side type. The complexity of the search is $(BIGOH haystack.length * max(needles.length)). (For needles that are individual items, length is considered to be 1.) The strategy used in searching several -subranges at once maximizes cache usage by moving in $(D haystack) as +subranges at once maximizes cache usage by moving in `haystack` as few times as possible. */ Tuple!(Range, size_t) find(alias pred = "a == b", Range, Ranges...) @@ -2031,7 +2031,7 @@ if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles)))) } /** - * Finds $(D needle) in $(D haystack) efficiently using the + * Finds `needle` in `haystack` efficiently using the * $(LUCKY Boyer-Moore) method. * * Params: @@ -2039,8 +2039,8 @@ if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles)))) * needle = A $(LREF BoyerMooreFinder). * * Returns: - * $(D haystack) advanced such that $(D needle) is a prefix of it (if no - * such position exists, returns $(D haystack) advanced to termination). + * `haystack` advanced such that `needle` is a prefix of it (if no + * such position exists, returns `haystack` advanced to termination). */ Range1 find(Range1, alias pred, Range2)( Range1 haystack, BoyerMooreFinder!(pred, Range2) needle) @@ -2092,9 +2092,9 @@ template canFind(alias pred="a == b") import std.typetuple : allSatisfy; /++ - Returns $(D true) if and only if any value $(D v) found in the - input range $(D range) satisfies the predicate $(D pred). - Performs (at most) $(BIGOH haystack.length) evaluations of $(D pred). + Returns `true` if and only if any value `v` found in the + input range `range` satisfies the predicate `pred`. + Performs (at most) $(BIGOH haystack.length) evaluations of `pred`. +/ bool canFind(Range)(Range haystack) if (is(typeof(find!pred(haystack)))) @@ -2103,8 +2103,8 @@ template canFind(alias pred="a == b") } /++ - Returns $(D true) if and only if $(D needle) can be found in $(D - range). Performs $(BIGOH haystack.length) evaluations of $(D pred). + Returns `true` if and only if `needle` can be found in $(D + range). Performs $(BIGOH haystack.length) evaluations of `pred`. +/ bool canFind(Range, Element)(Range haystack, Element needle) if (is(typeof(find!pred(haystack, needle)))) @@ -2113,13 +2113,13 @@ template canFind(alias pred="a == b") } /++ - Returns the 1-based index of the first needle found in $(D haystack). If no - needle is found, then $(D 0) is returned. + Returns the 1-based index of the first needle found in `haystack`. If no + needle is found, then `0` is returned. So, if used directly in the condition of an if statement or loop, the result - will be $(D true) if one of the needles is found and $(D false) if none are + will be `true` if one of the needles is found and `false` if none are found, whereas if the result is used elsewhere, it can either be cast to - $(D bool) for the same effect or used to get which needle was found first + `bool` for the same effect or used to get which needle was found first without having to deal with the tuple that $(D LREF find) returns for the same operation. +/ @@ -2167,17 +2167,17 @@ template canFind(alias pred="a == b") // findAdjacent /** -Advances $(D r) until it finds the first two adjacent elements $(D a), -$(D b) that satisfy $(D pred(a, b)). Performs $(BIGOH r.length) -evaluations of $(D pred). +Advances `r` until it finds the first two adjacent elements `a`, +`b` that satisfy $(D pred(a, b)). Performs $(BIGOH r.length) +evaluations of `pred`. Params: pred = The predicate to satisfy. r = A $(XREF2 range, isForwardRange, forward range) to search in. Returns: -$(D r) advanced to the first occurrence of two adjacent elements that satisfy -the given predicate. If there are no such two elements, returns $(D r) advanced +`r` advanced to the first occurrence of two adjacent elements that satisfy +the given predicate. If there are no such two elements, returns `r` advanced until empty. See_Also: @@ -2242,9 +2242,9 @@ Range findAdjacent(alias pred = "a == b", Range)(Range r) /** Searches the given range for an element that matches one of the given choices. -Advances $(D seq) by calling $(D seq.popFront) until either -$(D find!(pred)(choices, seq.front)) is $(D true), or $(D seq) becomes empty. -Performs $(BIGOH seq.length * choices.length) evaluations of $(D pred). +Advances `seq` by calling `seq.popFront` until either +$(D find!(pred)(choices, seq.front)) is `true`, or `seq` becomes empty. +Performs $(BIGOH seq.length * choices.length) evaluations of `pred`. Params: pred = The predicate to use for determining a match. @@ -2253,7 +2253,7 @@ Params: choices. Returns: -$(D seq) advanced to the first matching element, or until empty if there are no +`seq` advanced to the first matching element, or until empty if there are no matching elements. See_Also: @@ -2290,16 +2290,16 @@ Range1 findAmong(alias pred = "a == b", Range1, Range2)( // findSkip /** - * Finds $(D needle) in $(D haystack) and positions $(D haystack) - * right after the first occurrence of $(D needle). + * Finds `needle` in `haystack` and positions `haystack` + * right after the first occurrence of `needle`. * * Params: * haystack = The $(XREF2 range, isForwardRange, forward range) to search in. * needle = The $(XREF2 range, isForwardRange, forward range) to search for. * - * Returns: $(D true) if the needle was found, in which case $(D haystack) is - * positioned after the end of the first occurrence of $(D needle); otherwise - * $(D false), leaving $(D haystack) untouched. + * Returns: `true` if the needle was found, in which case `haystack` is + * positioned after the end of the first occurrence of `needle`; otherwise + * `false`, leaving `haystack` untouched. */ bool findSkip(alias pred = "a == b", R1, R2)(ref R1 haystack, R2 needle) if (isForwardRange!R1 && isForwardRange!R2 @@ -2330,35 +2330,35 @@ if (isForwardRange!R1 && isForwardRange!R2 } /** -These functions find the first occurrence of $(D needle) in $(D -haystack) and then split $(D haystack) as follows. - -$(D findSplit) returns a tuple $(D result) containing $(I three) -ranges. $(D result[0]) is the portion of $(D haystack) before $(D -needle), $(D result[1]) is the portion of $(D haystack) that matches -$(D needle), and $(D result[2]) is the portion of $(D haystack) after -the match. If $(D needle) was not found, $(D result[0]) -comprehends $(D haystack) entirely and $(D result[1]) and $(D result[2]) +These functions find the first occurrence of `needle` in $(D +haystack) and then split `haystack` as follows. + +`findSplit` returns a tuple `result` containing $(I three) +ranges. `result[0]` is the portion of `haystack` before $(D +needle), `result[1]` is the portion of `haystack` that matches +`needle`, and `result[2]` is the portion of `haystack` after +the match. If `needle` was not found, `result[0]` +comprehends `haystack` entirely and `result[1]` and `result[2]` are empty. -$(D findSplitBefore) returns a tuple $(D result) containing two -ranges. $(D result[0]) is the portion of $(D haystack) before $(D -needle), and $(D result[1]) is the balance of $(D haystack) starting -with the match. If $(D needle) was not found, $(D result[0]) -comprehends $(D haystack) entirely and $(D result[1]) is empty. +`findSplitBefore` returns a tuple `result` containing two +ranges. `result[0]` is the portion of `haystack` before $(D +needle), and `result[1]` is the balance of `haystack` starting +with the match. If `needle` was not found, `result[0]` +comprehends `haystack` entirely and `result[1]` is empty. -$(D findSplitAfter) returns a tuple $(D result) containing two ranges. -$(D result[0]) is the portion of $(D haystack) up to and including the -match, and $(D result[1]) is the balance of $(D haystack) starting -after the match. If $(D needle) was not found, $(D result[0]) is empty -and $(D result[1]) is $(D haystack). +`findSplitAfter` returns a tuple `result` containing two ranges. +`result[0]` is the portion of `haystack` up to and including the +match, and `result[1]` is the balance of `haystack` starting +after the match. If `needle` was not found, `result[0]` is empty +and `result[1]` is `haystack`. In all cases, the concatenation of the returned ranges spans the -entire $(D haystack). +entire `haystack`. -If $(D haystack) is a random-access range, all three components of the -tuple have the same type as $(D haystack). Otherwise, $(D haystack) -must be a forward range and the type of $(D result[0]) and $(D +If `haystack` is a random-access range, all three components of the +tuple have the same type as `haystack`. Otherwise, `haystack` +must be a forward range and the type of `result[0]` and $(D result[1]) is the same as $(XREF range,takeExactly). */ auto findSplit(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) @@ -2564,7 +2564,7 @@ if (isForwardRange!R1 && isForwardRange!R2) /** Returns the minimum element of a range together with the number of occurrences. The function can actually be used for counting the -maximum or any other ordering predicate (that's why $(D maxCount) is +maximum or any other ordering predicate (that's why `maxCount` is not provided). */ Tuple!(ElementType!Range, size_t) @@ -2752,10 +2752,10 @@ unittest // minPos /** Returns the position of the minimum element of forward range $(D -range), i.e. a subrange of $(D range) starting at the position of its -smallest element and with the same ending as $(D range). The function +range), i.e. a subrange of `range` starting at the position of its +smallest element and with the same ending as `range`. The function can actually be used for finding the maximum or any other ordering -predicate (that's why $(D maxPos) is not provided). +predicate (that's why `maxPos` is not provided). */ Range minPos(alias pred = "a < b", Range)(Range range) if (isForwardRange!Range && !isInfinite!Range && @@ -2841,11 +2841,11 @@ Params: range match. Defaults to equality $(D "a == b"). r1 = The $(XREF2 range, isForwardRange, forward range) to move forward. r2 = The $(XREF2 range, isInputRange, input range) representing the initial - segment of $(D r1) to skip over. + segment of `r1` to skip over. Returns: -true if the initial segment of $(D r1) matches $(D r2), and $(D r1) has been -advanced to the point past this segment; otherwise false, and $(D r1) is left +true if the initial segment of `r1` matches `r2`, and `r1` has been +advanced to the point past this segment; otherwise false, and `r1` is left in its original position. */ bool skipOver(alias pred = "a == b", R1, R2)(ref R1 r1, R2 r2) @@ -2950,12 +2950,12 @@ Returns: 0 if the needle(s) do not occur at the beginning of the given range; otherwise the position of the matching needle, that is, 1 if the range starts -with $(D withOneOfThese[0]), 2 if it starts with $(D withOneOfThese[1]), and so +with `withOneOfThese[0]`, 2 if it starts with `withOneOfThese[1]`, and so on. -In the case where $(D doesThisStart) starts with multiple of the ranges or -elements in $(D withOneOfThese), then the shortest one matches (if there are -two which match which are of the same length (e.g. $(D "a") and $(D 'a')), then +In the case where `doesThisStart` starts with multiple of the ranges or +elements in `withOneOfThese`, then the shortest one matches (if there are +two which match which are of the same length (e.g. `"a"` and `'a'`), then the left-most of them in the argument list matches). */ @@ -3225,8 +3225,8 @@ if (isInputRange!R && } /* (Not yet documented.) -Consume all elements from $(D r) that are equal to one of the elements -$(D es). +Consume all elements from `r` that are equal to one of the elements +`es`. */ void skipAll(alias pred = "a == b", R, Es...)(ref R r, Es es) //if (is(typeof(binaryFun!pred(r1.front, es[0])))) @@ -3254,7 +3254,7 @@ void skipAll(alias pred = "a == b", R, Es...)(ref R r, Es es) } /** -Interval option specifier for $(D until) (below) and others. +Interval option specifier for `until` (below) and others. */ enum OpenRight { @@ -3353,7 +3353,7 @@ struct Until(alias pred, Range, Sentinel) if (isInputRange!Range) } /** -Lazily iterates $(D range) _until the element $(D e) for which +Lazily iterates `range` _until the element `e` for which $(D pred(e, sentinel)) is true. Params: @@ -3361,8 +3361,8 @@ Params: range = The $(XREF2 range, isInputRange, input range) to iterate over. sentinel = The element to stop at. openRight = Determines whether the element for which the given predicate is - true should be included in the resulting range ($(D OpenRight.no)), or - not ($(D OpenRight.yes)). + true should be included in the resulting range (`OpenRight.no`), or + not (`OpenRight.yes`). Returns: An $(XREF2 range, isInputRange, input range) that iterates over the diff --git a/std/algorithm/setops.d b/std/algorithm/setops.d index be358736abf..c8ab1e59691 100644 --- a/std/algorithm/setops.d +++ b/std/algorithm/setops.d @@ -536,10 +536,10 @@ unittest // largestPartialIntersection /** -Given a range of sorted forward ranges $(D ror), copies to $(D tgt) +Given a range of sorted forward ranges `ror`, copies to `tgt` the elements that are common to most ranges, along with their number -of occurrences. All ranges in $(D ror) are assumed to be sorted by $(D -less). Only the most frequent $(D tgt.length) elements are returned. +of occurrences. All ranges in `ror` are assumed to be sorted by $(D +less). Only the most frequent `tgt.length` elements are returned. Example: ---- @@ -559,28 +559,28 @@ largestPartialIntersection(a, b); assert(b[0] == tuple(7.0, 4u)); ---- -$(D 7.0) is the correct answer because it occurs in $(D 4) out of the -$(D 5) inputs, more than any other number. The second member of the -resulting tuple is indeed $(D 4) (recording the number of occurrences -of $(D 7.0)). If more of the top-frequent numbers are needed, just -create a larger $(D tgt) range. In the example above, creating $(D b) -with length $(D 2) yields $(D tuple(1.0, 3u)) in the second position. +`7.0` is the correct answer because it occurs in `4` out of the +`5` inputs, more than any other number. The second member of the +resulting tuple is indeed `4` (recording the number of occurrences +of `7.0`). If more of the top-frequent numbers are needed, just +create a larger `tgt` range. In the example above, creating `b` +with length `2` yields $(D tuple(1.0, 3u)) in the second position. -The function $(D largestPartialIntersection) is useful for +The function `largestPartialIntersection` is useful for e.g. searching an $(LUCKY inverted index) for the documents most likely to contain some terms of interest. The complexity of the search -is $(BIGOH n * log(tgt.length)), where $(D n) is the sum of lengths of +is $(BIGOH n * log(tgt.length)), where `n` is the sum of lengths of all input ranges. This approach is faster than keeping an associative array of the occurrences and then selecting its top items, and also -requires less memory ($(D largestPartialIntersection) builds its -result directly in $(D tgt) and requires no extra memory). +requires less memory (`largestPartialIntersection` builds its +result directly in `tgt` and requires no extra memory). -Warning: Because $(D largestPartialIntersection) does not allocate -extra memory, it will leave $(D ror) modified. Namely, $(D -largestPartialIntersection) assumes ownership of $(D ror) and +Warning: Because `largestPartialIntersection` does not allocate +extra memory, it will leave `ror` modified. Namely, $(D +largestPartialIntersection) assumes ownership of `ror` and discretionarily swaps and advances elements of it. If you want $(D ror) to preserve its contents after the call, you may want to pass a -duplicate to $(D largestPartialIntersection) (and perhaps cache the +duplicate to `largestPartialIntersection` (and perhaps cache the duplicate in between calls). */ void largestPartialIntersection @@ -599,7 +599,7 @@ import std.algorithm : SortOutput; // FIXME // largestPartialIntersectionWeighted /** -Similar to $(D largestPartialIntersection), but associates a weight +Similar to `largestPartialIntersection`, but associates a weight with each distinct element in the intersection. Example: @@ -621,10 +621,10 @@ largestPartialIntersectionWeighted(a, b, weights); assert(b[0] == tuple(4.0, 2u)); ---- -The correct answer in this case is $(D 4.0), which, although only -appears two times, has a total weight $(D 4.6) (three times its weight -$(D 2.3)). The value $(D 7) is weighted with $(D 1.1) and occurs four -times for a total weight $(D 4.4). +The correct answer in this case is `4.0`, which, although only +appears two times, has a total weight `4.6` (three times its weight +`2.3`). The value `7` is weighted with `1.1` and occurs four +times for a total weight `4.4`. */ void largestPartialIntersectionWeighted (alias less = "a < b", RangeOfRanges, Range, WeightsAA) @@ -728,21 +728,21 @@ unittest Computes the union of multiple sets. The input sets are passed as a range of ranges and each is assumed to be sorted by $(D less). Computation is done lazily, one union element at a time. The -complexity of one $(D popFront) operation is $(BIGOH -log(ror.length)). However, the length of $(D ror) decreases as ranges +complexity of one `popFront` operation is $(BIGOH +log(ror.length)). However, the length of `ror` decreases as ranges in it are exhausted, so the complexity of a full pass through $(D NWayUnion) is dependent on the distribution of the lengths of ranges -contained within $(D ror). If all ranges have the same length $(D n) +contained within `ror`. If all ranges have the same length `n` (worst case scenario), the complexity of a full pass through $(D NWayUnion) is $(BIGOH n * ror.length * log(ror.length)), i.e., $(D log(ror.length)) times worse than just spanning all ranges in -turn. The output comes sorted (unstably) by $(D less). +turn. The output comes sorted (unstably) by `less`. -Warning: Because $(D NWayUnion) does not allocate extra memory, it -will leave $(D ror) modified. Namely, $(D NWayUnion) assumes ownership -of $(D ror) and discretionarily swaps and advances elements of it. If -you want $(D ror) to preserve its contents after the call, you may -want to pass a duplicate to $(D NWayUnion) (and perhaps cache the +Warning: Because `NWayUnion` does not allocate extra memory, it +will leave `ror` modified. Namely, `NWayUnion` assumes ownership +of `ror` and discretionarily swaps and advances elements of it. If +you want `ror` to preserve its contents after the call, you may +want to pass a duplicate to `NWayUnion` (and perhaps cache the duplicate in between calls). */ struct NWayUnion(alias less, RangeOfRanges) @@ -823,8 +823,8 @@ unittest } /** -Lazily computes the difference of $(D r1) and $(D r2). The two ranges -are assumed to be sorted by $(D less). The element types of the two +Lazily computes the difference of `r1` and `r2`. The two ranges +are assumed to be sorted by `less`. The element types of the two ranges must have a common type. */ struct SetDifference(alias less = "a < b", R1, R2) @@ -919,7 +919,7 @@ SetDifference!(less, R1, R2) setDifference(alias less = "a < b", R1, R2) /** Lazily computes the intersection of two or more input ranges $(D -ranges). The ranges are assumed to be sorted by $(D less). The element +ranges). The ranges are assumed to be sorted by `less`. The element types of the ranges must have a common type. */ struct SetIntersection(alias less = "a < b", Rs...) @@ -1061,14 +1061,14 @@ SetIntersection!(less, Rs) setIntersection(alias less = "a < b", Rs...)(Rs range } /** -Lazily computes the symmetric difference of $(D r1) and $(D r2), -i.e. the elements that are present in exactly one of $(D r1) and $(D -r2). The two ranges are assumed to be sorted by $(D less), and the -output is also sorted by $(D less). The element types of the two +Lazily computes the symmetric difference of `r1` and `r2`, +i.e. the elements that are present in exactly one of `r1` and $(D +r2). The two ranges are assumed to be sorted by `less`, and the +output is also sorted by `less`. The element types of the two ranges must have a common type. If both arguments are ranges of L-values of the same type then -$(D SetSymmetricDifference) will also be a range of L-values of +`SetSymmetricDifference` will also be a range of L-values of that type. */ struct SetSymmetricDifference(alias less = "a < b", R1, R2) @@ -1183,10 +1183,10 @@ setSymmetricDifference(alias less = "a < b", R1, R2) } /** -Lazily computes the union of two or more ranges $(D rs). The ranges -are assumed to be sorted by $(D less). Elements in the output are not +Lazily computes the union of two or more ranges `rs`. The ranges +are assumed to be sorted by `less`. Elements in the output are not unique; the length of the output is the sum of the lengths of the -inputs. (The $(D length) member is offered if all ranges also have +inputs. (The `length` member is offered if all ranges also have length.) The element types of all ranges must have a common type. */ struct SetUnion(alias less = "a < b", Rs...) if (allSatisfy!(isInputRange, Rs)) diff --git a/std/algorithm/sorting.d b/std/algorithm/sorting.d index 20e06acb6fc..83797b8ef96 100644 --- a/std/algorithm/sorting.d +++ b/std/algorithm/sorting.d @@ -11,14 +11,14 @@ $(T2 completeSort, If $(D a = [10, 20, 30]) and $(D b = [40, 6, 15]), then $(D completeSort(a, b)) leaves $(D a = [6, 10, 15]) and $(D b = [20, 30, 40]). - The range $(D a) must be sorted prior to the call, and as a result the + The range `a` must be sorted prior to the call, and as a result the combination $(D $(XREF range,chain)(a, b)) is sorted.) $(T2 isPartitioned, - $(D isPartitioned!"a < 0"([-1, -2, 1, 0, 2])) returns $(D true) because - the predicate is $(D true) for a portion of the range and $(D false) + $(D isPartitioned!"a < 0"([-1, -2, 1, 0, 2])) returns `true` because + the predicate is `true` for a portion of the range and `false` afterwards.) $(T2 isSorted, - $(D isSorted([1, 1, 2, 3])) returns $(D true).) + $(D isSorted([1, 1, 2, 3])) returns `true`.) $(T2 makeIndex, Creates a separate index for a range.) $(T2 nextEvenPermutation, @@ -30,7 +30,7 @@ $(T2 nextPermutation, $(T2 partialSort, If $(D a = [5, 4, 3, 2, 1]), then $(D partialSort(a, 3)) leaves $(D a[0 .. 3] = [1, 2, 3]). - The other elements of $(D a) are left in an unspecified order.) + The other elements of `a` are left in an unspecified order.) $(T2 partition, Partitions a range according to a predicate.) $(T2 partition3, @@ -72,12 +72,12 @@ import std.traits; // completeSort /** Sorts the random-access range $(D chain(lhs, rhs)) according to -predicate $(D less). The left-hand side of the range $(D lhs) is -assumed to be already sorted; $(D rhs) is assumed to be unsorted. The -exact strategy chosen depends on the relative sizes of $(D lhs) and -$(D rhs). Performs $(BIGOH lhs.length + rhs.length * log(rhs.length)) +predicate `less`. The left-hand side of the range `lhs` is +assumed to be already sorted; `rhs` is assumed to be unsorted. The +exact strategy chosen depends on the relative sizes of `lhs` and +`rhs`. Performs $(BIGOH lhs.length + rhs.length * log(rhs.length)) (best case) to $(BIGOH (lhs.length + rhs.length) * log(lhs.length + -rhs.length)) (worst-case) evaluations of $(D swap). +rhs.length)) (worst-case) evaluations of `swap`. */ void completeSort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Range1, Range2)(SortedRange!(Range1, less) lhs, Range2 rhs) @@ -111,7 +111,7 @@ unittest // isSorted /** Checks whether a forward range is sorted according to the comparison -operation $(D less). Performs $(BIGOH r.length) evaluations of $(D +operation `less`. Performs $(BIGOH r.length) evaluations of $(D less). */ bool isSorted(alias less = "a < b", Range)(Range r) if (isForwardRange!(Range)) @@ -186,27 +186,27 @@ bool isSorted(alias less = "a < b", Range)(Range r) if (isForwardRange!(Range)) // partition /** -Partitions a range in two using $(D pred) as a +Partitions a range in two using `pred` as a predicate. Specifically, reorders the range $(D r = [left, -right$(RPAREN)) using $(D swap) such that all elements $(D i) for -which $(D pred(i)) is $(D true) come before all elements $(D j) for -which $(D pred(j)) returns $(D false). +right$(RPAREN)) using `swap` such that all elements `i` for +which `pred(i)` is `true` come before all elements `j` for +which `pred(j)` returns `false`. Performs $(BIGOH r.length) (if unstable or semistable) or $(BIGOH -r.length * log(r.length)) (if stable) evaluations of $(D less) and $(D +r.length * log(r.length)) (if stable) evaluations of `less` and $(D swap). The unstable version computes the minimum possible evaluations -of $(D swap) (roughly half of those performed by the semistable +of `swap` (roughly half of those performed by the semistable version). Returns: -The right part of $(D r) after partitioning. +The right part of `r` after partitioning. -If $(D ss == SwapStrategy.stable), $(D partition) preserves the -relative ordering of all elements $(D a), $(D b) in $(D r) for which +If $(D ss == SwapStrategy.stable), `partition` preserves the +relative ordering of all elements `a`, `b` in `r` for which $(D pred(a) == pred(b)). If $(D ss == SwapStrategy.semistable), $(D -partition) preserves the relative ordering of all elements $(D a), $(D -b) in the left part of $(D r) for which $(D pred(a) == pred(b)). +partition) preserves the relative ordering of all elements `a`, $(D +b) in the left part of `r` for which $(D pred(a) == pred(b)). See_Also: STL's $(WEB sgi.com/tech/stl/_partition.html, _partition)$(BR) @@ -346,7 +346,7 @@ Range partition(alias predicate, } /** -Returns $(D true) if $(D r) is partitioned according to predicate $(D +Returns `true` if `r` is partitioned according to predicate $(D pred). */ bool isPartitioned(alias pred, Range)(Range r) @@ -373,15 +373,15 @@ bool isPartitioned(alias pred, Range)(Range r) // partition3 /** -Rearranges elements in $(D r) in three adjacent ranges and returns -them. The first and leftmost range only contains elements in $(D r) -less than $(D pivot). The second and middle range only contains -elements in $(D r) that are equal to $(D pivot). Finally, the third -and rightmost range only contains elements in $(D r) that are greater -than $(D pivot). The less-than test is defined by the binary function -$(D less). - -BUGS: stable $(D partition3) has not been implemented yet. +Rearranges elements in `r` in three adjacent ranges and returns +them. The first and leftmost range only contains elements in `r` +less than `pivot`. The second and middle range only contains +elements in `r` that are equal to `pivot`. Finally, the third +and rightmost range only contains elements in `r` that are greater +than `pivot`. The less-than test is defined by the binary function +`less`. + +BUGS: stable `partition3` has not been implemented yet. */ auto partition3(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, Range, E) (Range r, E pivot) @@ -475,7 +475,7 @@ if (ss == SwapStrategy.unstable && isRandomAccessRange!Range // makeIndex /** -Computes an index for $(D r) based on the comparison $(D less). The +Computes an index for `r` based on the comparison `less`. The index is a sorted array of pointers or indices into the original range. This technique is similar to sorting, but it is more flexible because (1) it allows "sorting" of immutable collections, (2) allows @@ -485,21 +485,21 @@ and (4) may be faster when dealing with large objects. However, using an index may also be slower under certain circumstances due to the extra indirection, and is always larger than a sorting-based solution because it needs space for the index in addition to the original -collection. The complexity is the same as $(D sort)'s. +collection. The complexity is the same as `sort`'s. -The first overload of $(D makeIndex) writes to a range containing +The first overload of `makeIndex` writes to a range containing pointers, and the second writes to a range containing offsets. The -first overload requires $(D Range) to be a forward range, and the +first overload requires `Range` to be a forward range, and the latter requires it to be a random-access range. -$(D makeIndex) overwrites its second argument with the result, but +`makeIndex` overwrites its second argument with the result, but never reallocates it. -Returns: The pointer-based version returns a $(D SortedRange) wrapper +Returns: The pointer-based version returns a `SortedRange` wrapper over index, of type $(D SortedRange!(RangeIndex, (a, b) => binaryFun!less(*a, *b))) thus reflecting the ordering of the -index. The index-based version returns $(D void) because the ordering -relation involves not only $(D index) but also $(D r). +index. The index-based version returns `void` because the ordering +relation involves not only `index` but also `r`. Throws: If the second argument's length is less than that of the range indexed, an exception is thrown. @@ -627,10 +627,10 @@ $(D void multiSort(Range)(Range r) if (validPredicates!(ElementType!Range, less));) Sorts a range by multiple keys. The call $(D multiSort!("a.id < b.id", -"a.date > b.date")(r)) sorts the range $(D r) by $(D id) ascending, -and sorts elements that have the same $(D id) by $(D date) +"a.date > b.date")(r)) sorts the range `r` by `id` ascending, +and sorts elements that have the same `id` by `date` descending. Such a call is equivalent to $(D sort!"a.id != b.id ? a.id -< b.id : a.date > b.date"(r)), but $(D multiSort) is faster because it +< b.id : a.date > b.date"(r)), but `multiSort` is faster because it does fewer comparisons (in addition to being more convenient). */ template multiSort(less...) //if (less.length > 1) @@ -825,28 +825,28 @@ private void optimisticInsertionSort(alias less, Range)(Range r) // sort /** -Sorts a random-access range according to the predicate $(D less). Performs -$(BIGOH r.length * log(r.length)) evaluations of $(D less). Stable sorting -requires $(D hasAssignableElements!Range) to be true. +Sorts a random-access range according to the predicate `less`. Performs +$(BIGOH r.length * log(r.length)) evaluations of `less`. Stable sorting +requires `hasAssignableElements!Range` to be true. -$(D sort) returns a $(XREF range, SortedRange) over the original range, which +`sort` returns a $(XREF range, SortedRange) over the original range, which functions that can take advantage of sorted data can then use to know that the range is sorted and adjust accordingly. The $(XREF range, SortedRange) is a wrapper around the original range, so both it and the original range are sorted, but other functions won't know that the original range has been sorted, whereas they $(I can) know that $(XREF range, SortedRange) has been sorted. -The predicate is expected to satisfy certain rules in order for $(D sort) to +The predicate is expected to satisfy certain rules in order for `sort` to behave as expected - otherwise, the program may fail on certain inputs (but not -others) when not compiled in release mode, due to the cursory $(D assumeSorted) -check. Specifically, $(D sort) expects $(D less(a,b) && less(b,c)) to imply -$(D less(a,c)) (transitivity), and, conversely, $(D !less(a,b) && !less(b,c)) to -imply $(D !less(a,c)). Note that the default predicate ($(D "a < b")) does not +others) when not compiled in release mode, due to the cursory `assumeSorted` +check. Specifically, `sort` expects $(D less(a,b) && less(b,c)) to imply +`less(a,c)` (transitivity), and, conversely, $(D !less(a,b) && !less(b,c)) to +imply `!less(a,c)`. Note that the default predicate ($(D "a < b")) does not always satisfy these conditions for floating point types, because the expression -will always be $(D false) when either $(D a) or $(D b) is NaN. +will always be `false` when either `a` or `b` is NaN. -Returns: The initial range wrapped as a $(D SortedRange) with the predicate -$(D binaryFun!less). +Returns: The initial range wrapped as a `SortedRange` with the predicate +`binaryFun!less`. Algorithms: $(WEB en.wikipedia.org/wiki/Introsort) is used for unstable sorting and $(WEB en.wikipedia.org/wiki/Timsort, Timsort) is used for stable sorting. @@ -1768,8 +1768,8 @@ known as the decorate-sort-undecorate pattern in Python and Lisp. (Not to be confused with $(WEB youtube.com/watch?v=UHw6KXbvazs, the other Schwartz).) This function is helpful when the sort comparison includes an expensive computation. The complexity is the same as that of the -corresponding $(D sort), but $(D schwartzSort) evaluates $(D -transform) only $(D r.length) times (less than half when compared to +corresponding `sort`, but `schwartzSort` evaluates $(D +transform) only `r.length` times (less than half when compared to regular sorting). The usage can be best illustrated with an example. Examples: @@ -1782,18 +1782,18 @@ sort!((a, b) => hashFun(a) < hashFun(b))(array); schwartzSort!(hashFun, "a < b")(array); ---- -The $(D schwartzSort) function might require less temporary data and +The `schwartzSort` function might require less temporary data and be faster than the Perl idiom or the decorate-sort-undecorate idiom present in Python and Lisp. This is because sorting is done in-place and only minimal extra data (one array of transformed elements) is created. To check whether an array was sorted and benefit of the speedup of -Schwartz sorting, a function $(D schwartzIsSorted) is not provided +Schwartz sorting, a function `schwartzIsSorted` is not provided because the effect can be achieved by calling $(D isSorted!less(map!transform(r))). -Returns: The initial range wrapped as a $(D SortedRange) with the +Returns: The initial range wrapped as a `SortedRange` with the predicate $(D (a, b) => binaryFun!less(transform(a), transform(b))). */ @@ -1921,10 +1921,10 @@ unittest // partialSort /** -Reorders the random-access range $(D r) such that the range $(D r[0 -.. mid]) is the same as if the entire $(D r) were sorted, and leaves +Reorders the random-access range `r` such that the range $(D r[0 +.. mid]) is the same as if the entire `r` were sorted, and leaves the range $(D r[mid .. r.length]) in no particular order. Performs -$(BIGOH r.length * log(mid)) evaluations of $(D pred). The +$(BIGOH r.length * log(mid)) evaluations of `pred`. The implementation simply calls $(D topN!(less, ss)(r, n)) and then $(D sort!(less, ss)(r[0 .. n])). */ @@ -1946,15 +1946,15 @@ void partialSort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, // topN /** -Reorders the range $(D r) using $(D swap) such that $(D r[nth]) refers +Reorders the range `r` using `swap` such that `r[nth]` refers to the element that would fall there if the range were fully -sorted. In addition, it also partitions $(D r) such that all elements -$(D e1) from $(D r[0]) to $(D r[nth]) satisfy $(D !less(r[nth], e1)), -and all elements $(D e2) from $(D r[nth]) to $(D r[r.length]) satisfy +sorted. In addition, it also partitions `r` such that all elements +`e1` from `r[0]` to `r[nth]` satisfy $(D !less(r[nth], e1)), +and all elements `e2` from `r[nth]` to `r[r.length]` satisfy $(D !less(e2, r[nth])). Effectively, it finds the nth smallest -(according to $(D less)) elements in $(D r). Performs an expected +(according to `less`) elements in `r`. Performs an expected $(BIGOH r.length) (if unstable) or $(BIGOH r.length * log(r.length)) -(if stable) evaluations of $(D less) and $(D swap). +(if stable) evaluations of `less` and `swap`. If $(D n >= r.length), the algorithm has no effect. @@ -2119,10 +2119,10 @@ unittest } /** -Copies the top $(D n) elements of the input range $(D source) into the -random-access range $(D target), where $(D n = -target.length). Elements of $(D source) are not touched. If $(D -sorted) is $(D true), the target is sorted. Otherwise, the target +Copies the top `n` elements of the input range `source` into the +random-access range `target`, where $(D n = +target.length). Elements of `source` are not touched. If $(D +sorted) is `true`, the target is sorted. Otherwise, the target respects the $(WEB en.wikipedia.org/wiki/Binary_heap, heap property). */ TRange topNCopy(alias less = "a < b", SRange, TRange) @@ -2183,13 +2183,13 @@ Params: to make an index for. index = A $(XREF2 range, isRandomAccessRange, random-access range) with assignable elements to build the index in. The length of this range - determines how many top elements to index in $(D r). + determines how many top elements to index in `r`. This index range can either have integral elements, in which case the constructed index will consist of zero-based numerical indices into - $(D r); or it can have pointers to the element type of $(D r), in which + `r`; or it can have pointers to the element type of `r`, in which case the constructed index will be pointers to the top elements in - $(D r). + `r`. sorted = Determines whether to sort the index by the elements they refer to. @@ -2302,16 +2302,16 @@ unittest // nextPermutation /** - * Permutes $(D range) in-place to the next lexicographically greater + * Permutes `range` in-place to the next lexicographically greater * permutation. * - * The predicate $(D less) defines the lexicographical ordering to be used on + * The predicate `less` defines the lexicographical ordering to be used on * the range. * * If the range is currently the lexicographically greatest permutation, it is * permuted back to the least permutation and false is returned. Otherwise, * true is returned. One can thus generate all permutations of a range by - * sorting it according to $(D less), which produces the lexicographically + * sorting it according to `less`, which produces the lexicographically * least permutation, and then calling nextPermutation until it returns false. * This is guaranteed to generate all distinct permutations of the range * exactly once. If there are $(I N) elements in the range and all of them are @@ -2520,10 +2520,10 @@ bool nextPermutation(alias less="a < b", BidirectionalRange) // nextEvenPermutation /** - * Permutes $(D range) in-place to the next lexicographically greater $(I even) + * Permutes `range` in-place to the next lexicographically greater $(I even) * permutation. * - * The predicate $(D less) defines the lexicographical ordering to be used on + * The predicate `less` defines the lexicographical ordering to be used on * the range. * * An even permutation is one which is produced by swapping an even number of diff --git a/std/array.d b/std/array.d index 194785f24c0..c95ecc93a53 100644 --- a/std/array.d +++ b/std/array.d @@ -24,7 +24,7 @@ $(BOOKTABLE , $(TD Concatenates a range of ranges into one _array. )) $(TR $(TD $(D $(LREF minimallyInitializedArray))) - $(TD Returns a new _array of type $(D T). + $(TD Returns a new _array of type `T`. )) $(TR $(TD $(D $(LREF replace))) $(TD Returns a new _array with all occurrences of a certain subrange replaced. @@ -51,7 +51,7 @@ $(BOOKTABLE , $(TD Eagerly split a range or string into an _array. )) $(TR $(TD $(D $(LREF uninitializedArray))) - $(TD Returns a new _array of type $(D T) without initializing its elements. + $(TD Returns a new _array of type `T` without initializing its elements. )) ) @@ -76,7 +76,7 @@ public import std.range.primitives : save, empty, popFront, popBack, front, back /** Returns a newly allocated dynamic array consisting of a copy of the input range, static array, dynamic array, or class or struct with an -$(D opApply) function $(D r). Note that narrow strings are handled as +`opApply` function `r`. Note that narrow strings are handled as a special case in an overload. */ ForeachType!Range[] array(Range)(Range r) @@ -176,8 +176,8 @@ unittest /** Convert a narrow string to an array type that fully supports random access. -This is handled as a special case and always returns a $(D dchar[]), -$(D const(dchar)[]), or $(D immutable(dchar)[]) depending on the constness of +This is handled as a special case and always returns a `dchar[]`, +`const(dchar)[]`, or `immutable(dchar)[]` depending on the constness of the input. */ ElementType!String[] array(String)(String str) if (isNarrowString!String) @@ -471,11 +471,11 @@ version(unittest) } /++ -Returns a new array of type $(D T) allocated on the garbage collected heap +Returns a new array of type `T` allocated on the garbage collected heap without initializing its elements. This can be a useful optimization if every -element will be immediately initialized. $(D T) may be a multidimensional +element will be immediately initialized. `T` may be a multidimensional array. In this case sizes may be specified for any number of dimensions from 0 -to the number in $(D T). +to the number in `T`. uninitializedArray is nothrow and weakly pure. +/ @@ -506,11 +506,11 @@ nothrow pure unittest } /++ -Returns a new array of type $(D T) allocated on the garbage collected heap. +Returns a new array of type `T` allocated on the garbage collected heap. Partial initialization is done for types with indirections, for preservation of memory safety. Note that elements will only be initialized to 0, but not -necessarily the element type's $(D .init). +necessarily the element type's `.init`. minimallyInitializedArray is nothrow and weakly pure. +/ @@ -672,8 +672,8 @@ nothrow unittest /* NOTE: Undocumented for now, overlap does not yet work with ctfe. Returns the overlapping portion, if any, of two arrays. Unlike $(D -equal), $(D overlap) only compares the pointers in the ranges, not the -values referred by them. If $(D r1) and $(D r2) have an overlapping +equal), `overlap` only compares the pointers in the ranges, not the +values referred by them. If `r1` and `r2` have an overlapping slice, returns that slice. Otherwise, returns the null slice. */ inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2) @trusted pure nothrow @@ -753,8 +753,8 @@ be used once insert has not only been deprecated but removed, but until then, it's commented out. /++ - Creates a new array which is a copy of $(D array) with $(D stuff) (which - must be an input range or a single item) inserted at position $(D pos). + Creates a new array which is a copy of `array` with `stuff` (which + must be an input range or a single item) inserted at position `pos`. Examples: -------------------- @@ -883,8 +883,8 @@ private void copyBackwards(T)(T[] src, T[] dest) } /++ - Inserts $(D stuff) (which must be an input range or any number of - implicitly convertible items) in $(D array) at position $(D pos). + Inserts `stuff` (which must be an input range or any number of + implicitly convertible items) in `array` at position `pos`. +/ void insertInPlace(T, U...)(ref T[] array, size_t pos, U stuff) @@ -1232,9 +1232,9 @@ unittest // bugzilla 6874 /++ - Returns whether the $(D front)s of $(D lhs) and $(D rhs) both refer to the + Returns whether the `front`s of `lhs` and `rhs` both refer to the same place in memory, making one of the arrays a slice of the other which - starts at index $(D 0). + starts at index `0`. +/ @safe pure nothrow bool sameHead(T)(in T[] lhs, in T[] rhs) @@ -1244,9 +1244,9 @@ pure nothrow bool sameHead(T)(in T[] lhs, in T[] rhs) /++ - Returns whether the $(D back)s of $(D lhs) and $(D rhs) both refer to the + Returns whether the `back`s of `lhs` and `rhs` both refer to the same place in memory, making one of the arrays a slice of the other which - end at index $(D $). + end at index `$`. +/ @trusted pure nothrow bool sameTail(T)(in T[] lhs, in T[] rhs) @@ -1283,8 +1283,8 @@ pure nothrow bool sameTail(T)(in T[] lhs, in T[] rhs) } /******************************************** -Returns an array that consists of $(D s) (which must be an input -range) repeated $(D n) times. This function allocates, fills, and +Returns an array that consists of `s` (which must be an input +range) repeated `n` times. This function allocates, fills, and returns a new array. For a lazy version, refer to $(XREF range, repeat). */ ElementEncodingType!S[] replicate(S)(S s, size_t n) if (isDynamicArray!S) @@ -1340,10 +1340,10 @@ unittest } /++ -Eagerly split the string $(D s) into an array of words, using whitespace as +Eagerly split the string `s` into an array of words, using whitespace as delimiter. Runs of whitespace are merged together (no empty words are produced). -$(D @safe), $(D pure) and $(D CTFE)-able. +`@safe`, `pure` and `CTFE`-able. See_Also: $(XREF algorithm, splitter) for a version that splits using any separator. @@ -1434,25 +1434,25 @@ deprecated("Please use std.algorithm.iteration.splitter instead.") alias splitter = std.algorithm.iteration.splitter; /++ - Eagerly splits $(D range) into an array, using $(D sep) as the delimiter. + Eagerly splits `range` into an array, using `sep` as the delimiter. The range must be a $(XREF2 range, isForwardRange, forward range). - The separator can be a value of the same type as the elements in $(D range) or + The separator can be a value of the same type as the elements in `range` or it can be another forward range. Examples: - If $(D range) is a $(D string), $(D sep) can be a $(D char) or another - $(D string). The return type will be an array of strings. If $(D range) is - an $(D int) array, $(D sep) can be an $(D int) or another $(D int) array. - The return type will be an array of $(D int) arrays. + If `range` is a `string`, `sep` can be a `char` or another + `string`. The return type will be an array of strings. If `range` is + an `int` array, `sep` can be an `int` or another `int` array. + The return type will be an array of `int` arrays. Params: range = a forward range. - sep = a value of the same type as the elements of $(D range) or another + sep = a value of the same type as the elements of `range` or another forward range. Returns: - An array containing the divided parts of $(D range). + An array containing the divided parts of `range`. See_Also: $(XREF algorithm, splitter) for the lazy version of this function. @@ -1534,17 +1534,17 @@ unittest /++ Conservative heuristic to determine if a range can be iterated cheaply. - Used by $(D join) in decision to do an extra iteration of the range to + Used by `join` in decision to do an extra iteration of the range to compute the resultant length. If iteration is not cheap then precomputing - length could be more expensive than using $(D Appender). + length could be more expensive than using `Appender`. For now, we only assume arrays are cheap to iterate. +/ private enum bool hasCheapIteration(R) = isArray!R; /++ - Concatenates all of the ranges in $(D ror) together into one array using - $(D sep) as the separator if present. + Concatenates all of the ranges in `ror` together into one array using + `sep` as the separator if present. Params: ror = Range of Ranges of Elements @@ -1907,8 +1907,8 @@ unittest /++ - Replace occurrences of $(D from) with $(D to) in $(D subject). Returns a new - array without changing the contents of $(D subject), or the original array + Replace occurrences of `from` with `to` in `subject`. Returns a new + array without changing the contents of `subject`, or the original array if no match is found. +/ E[] replace(E, R1, R2)(E[] subject, R1 from, R2 to) @@ -1937,8 +1937,8 @@ unittest } /++ - Same as above, but outputs the result via OutputRange $(D sink). - If no match is found the original array is transferred to $(D sink) as is. + Same as above, but outputs the result via OutputRange `sink`. + If no match is found the original array is transferred to `sink` as is. +/ void replaceInto(E, Sink, R1, R2)(Sink sink, E[] subject, R1 from, R2 to) if (isOutputRange!(Sink, E) && isDynamicArray!(E[]) @@ -2020,9 +2020,9 @@ unittest } /++ - Replaces elements from $(D array) with indices ranging from $(D from) - (inclusive) to $(D to) (exclusive) with the range $(D stuff). Returns a new - array without changing the contents of $(D subject). + Replaces elements from `array` with indices ranging from `from` + (inclusive) to `to` (exclusive) with the range `stuff`. Returns a new + array without changing the contents of `subject`. +/ T[] replace(T, Range)(T[] subject, size_t from, size_t to, Range stuff) if(isInputRange!Range && @@ -2136,8 +2136,8 @@ unittest } /++ - Replaces elements from $(D array) with indices ranging from $(D from) - (inclusive) to $(D to) (exclusive) with the range $(D stuff). Expands or + Replaces elements from `array` with indices ranging from `from` + (inclusive) to `to` (exclusive) with the range `stuff`. Expands or shrinks the array as needed. +/ void replaceInPlace(T, Range)(ref T[] array, size_t from, size_t to, Range stuff) @@ -2277,8 +2277,8 @@ unittest } /++ - Replaces the first occurrence of $(D from) with $(D to) in $(D a). Returns a - new array without changing the contents of $(D subject), or the original + Replaces the first occurrence of `from` with `to` in `a`. Returns a + new array without changing the contents of `subject`, or the original array if no match is found. +/ E[] replaceFirst(E, R1, R2)(E[] subject, R1 from, R2 to) @@ -2377,8 +2377,8 @@ unittest } /++ - Replaces the last occurrence of $(D from) with $(D to) in $(D a). Returns a - new array without changing the contents of $(D subject), or the original + Replaces the last occurrence of `from` with `to` in `a`. Returns a + new array without changing the contents of `subject`, or the original array if no match is found. +/ E[] replaceLast(E, R1, R2)(E[] subject, R1 from , R2 to) @@ -2477,8 +2477,8 @@ unittest } /++ - Returns a new array that is $(D s) with $(D slice) replaced by - $(D replacement[]). + Returns a new array that is `s` with `slice` replaced by + `replacement[]`. +/ inout(T)[] replaceSlice(T)(inout(T)[] s, in T[] slice, in T[] replacement) in @@ -2598,7 +2598,7 @@ if (isDynamicArray!A) /** * Returns the capacity of the array (the maximum number of elements the * managed array can accommodate before triggering a reallocation). If any - * appending will reallocate, $(D capacity) returns $(D 0). + * appending will reallocate, `capacity` returns `0`. */ @property size_t capacity() const @safe pure nothrow { @@ -2834,7 +2834,7 @@ if (isDynamicArray!A) * for appending. * * Note that clear is disabled for immutable or const element types, due to the - * possibility that $(D Appender) might overwrite immutable data. + * possibility that `Appender` might overwrite immutable data. */ void clear() @safe pure nothrow { @@ -2847,7 +2847,7 @@ if (isDynamicArray!A) /** * Shrinks the managed array to the given length. * - * Throws: $(D Exception) if newlength is greater than the current array length. + * Throws: `Exception` if newlength is greater than the current array length. */ void shrinkTo(size_t newlength) @safe pure { @@ -2936,7 +2936,7 @@ if (isDynamicArray!A) /** * Construct a ref appender with a given array reference. This does not copy the * data. If the array has a larger capacity as determined by arr.capacity, it - * will be used by the appender. $(D RefAppender) assumes that arr is a non-null + * will be used by the appender. `RefAppender` assumes that arr is a non-null * value. * * Note, do not use builtin appending (i.e. ~=) on the original array passed in @@ -2986,7 +2986,7 @@ if (isDynamicArray!A) /** * Returns the capacity of the array (the maximum number of elements the * managed array can accommodate before triggering a reallocation). If any - * appending will reallocate, $(D capacity) returns $(D 0). + * appending will reallocate, `capacity` returns `0`. */ @property size_t capacity() const { @@ -3003,8 +3003,8 @@ if (isDynamicArray!A) } /++ - Convenience function that returns an $(D Appender!A) object initialized - with $(D array). + Convenience function that returns an `Appender!A` object initialized + with `array`. +/ Appender!A appender(A)() if (isDynamicArray!A) @@ -3380,9 +3380,9 @@ unittest } /++ - Convenience function that returns a $(D RefAppender!A) object initialized - with $(D array). Don't use null for the $(D array) pointer, use the other - version of $(D appender) instead. + Convenience function that returns a `RefAppender!A` object initialized + with `array`. Don't use null for the `array` pointer, use the other + version of `appender` instead. +/ RefAppender!(E[]) appender(A : E[]*, E)(A array) { diff --git a/std/ascii.d b/std/ascii.d index 493fd6f6ee5..f8a10b0499a 100644 --- a/std/ascii.d +++ b/std/ascii.d @@ -4,8 +4,8 @@ Functions which operate on ASCII characters. All of the functions in std.ascii accept Unicode characters but effectively - ignore them if they're not ASCII. All $(D isX) functions return $(D false) - for non-ASCII characters, and all $(D toX) functions do nothing to non-ASCII + ignore them if they're not ASCII. All `isX` functions return `false` + for non-ASCII characters, and all `toX` functions do nothing to non-ASCII characters. For functions which operate on Unicode characters, see @@ -63,7 +63,7 @@ else /++ - Returns whether $(D c) is a letter or a number (0..9, a..z, A..Z). + Returns whether `c` is a letter or a number (0..9, a..z, A..Z). +/ bool isAlphaNum(dchar c) @safe pure nothrow @nogc { @@ -81,7 +81,7 @@ unittest /++ - Returns whether $(D c) is an ASCII letter (A..Z, a..z). + Returns whether `c` is an ASCII letter (A..Z, a..z). +/ bool isAlpha(dchar c) @safe pure nothrow @nogc { @@ -100,7 +100,7 @@ unittest /++ - Returns whether $(D c) is a lowercase ASCII letter (a..z). + Returns whether `c` is a lowercase ASCII letter (a..z). +/ bool isLower(dchar c) @safe pure nothrow @nogc { @@ -118,7 +118,7 @@ unittest /++ - Returns whether $(D c) is an uppercase ASCII letter (A..Z). + Returns whether `c` is an uppercase ASCII letter (A..Z). +/ bool isUpper(dchar c) @safe pure nothrow @nogc { @@ -136,7 +136,7 @@ unittest /++ - Returns whether $(D c) is a digit (0..9). + Returns whether `c` is a digit (0..9). +/ bool isDigit(dchar c) @safe pure nothrow @nogc { @@ -154,7 +154,7 @@ unittest /++ - Returns whether $(D c) is a digit in base 8 (0..7). + Returns whether `c` is a digit in base 8 (0..7). +/ bool isOctalDigit(dchar c) @safe pure nothrow @nogc { @@ -172,7 +172,7 @@ unittest /++ - Returns whether $(D c) is a digit in base 16 (0..9, A..F, a..f). + Returns whether `c` is a digit in base 16 (0..9, A..F, a..f). +/ bool isHexDigit(dchar c) @safe pure nothrow @nogc { @@ -190,7 +190,7 @@ unittest /++ - Whether or not $(D c) is a whitespace character. That includes the space, + Whether or not `c` is a whitespace character. That includes the space, tab, vertical tab, form feed, carriage return, and linefeed characters. +/ bool isWhite(dchar c) @safe pure nothrow @nogc @@ -209,7 +209,7 @@ unittest /++ - Returns whether $(D c) is a control character. + Returns whether `c` is a control character. +/ bool isControl(dchar c) @safe pure nothrow @nogc { @@ -228,7 +228,7 @@ unittest /++ - Whether or not $(D c) is a punctuation character. That includes all ASCII + Whether or not `c` is a punctuation character. That includes all ASCII characters which are not control characters, letters, digits, or whitespace. +/ bool isPunctuation(dchar c) @safe pure nothrow @nogc @@ -249,7 +249,7 @@ unittest /++ - Whether or not $(D c) is a printable character other than the space + Whether or not `c` is a printable character other than the space character. +/ bool isGraphical(dchar c) @safe pure nothrow @nogc @@ -270,7 +270,7 @@ unittest /++ - Whether or not $(D c) is a printable character - including the space + Whether or not `c` is a printable character - including the space character. +/ bool isPrintable(dchar c) @safe pure nothrow @nogc @@ -291,7 +291,7 @@ unittest /++ - Whether or not $(D c) is in the ASCII character set - i.e. in the range + Whether or not `c` is in the ASCII character set - i.e. in the range 0..0x7F. +/ bool isASCII(dchar c) @safe pure nothrow @nogc @@ -309,13 +309,13 @@ unittest /++ - If $(D c) is an uppercase ASCII character, then its corresponding lowercase - letter is returned. Otherwise, $(D c) is returned. + If `c` is an uppercase ASCII character, then its corresponding lowercase + letter is returned. Otherwise, `c` is returned. - $(D C) can be any type which implicitly converts to $(D dchar). In the case + `C` can be any type which implicitly converts to `dchar`. In the case where it's a built-in type, or an enum of a built-in type, - $(D Unqual!(OriginalType!C)) is returned, whereas if it's a user-defined - type, $(D dchar) is returned. + `Unqual!(OriginalType!C)` is returned, whereas if it's a user-defined + type, `dchar` is returned. +/ auto toLower(C)(C c) if(is(C : dchar)) @@ -358,13 +358,13 @@ auto toLower(C)(C c) /++ - If $(D c) is a lowercase ASCII character, then its corresponding uppercase - letter is returned. Otherwise, $(D c) is returned. + If `c` is a lowercase ASCII character, then its corresponding uppercase + letter is returned. Otherwise, `c` is returned. - $(D C) can be any type which implicitly converts to $(D dchar). In the case + `C` can be any type which implicitly converts to `dchar`. In the case where it's a built-in type, or an enum of a built-in type, - $(D Unqual!(OriginalType!C)) is returned, whereas if it's a user-defined - type, $(D dchar) is returned. + `Unqual!(OriginalType!C)` is returned, whereas if it's a user-defined + type, `dchar` is returned. +/ auto toUpper(C)(C c) if(is(C : dchar)) diff --git a/std/base64.d b/std/base64.d index f4ff9a90b1b..f6779175962 100644 --- a/std/base64.d +++ b/std/base64.d @@ -126,7 +126,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Encodes $(D_PARAM source) into $(D_PARAM buffer). * * Params: - * source = an $(D InputRange) to encode. + * source = an `InputRange` to encode. * buffer = a buffer to store encoded result. * * Returns: @@ -267,8 +267,8 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Encodes $(D_PARAM source) into $(D_PARAM range). * * Params: - * source = an $(D InputRange) to encode. - * range = an $(D OutputRange) to put encoded result. + * source = an `InputRange` to encode. + * range = an `OutputRange` to put encoded result. * * Returns: * the number of calling put. @@ -499,7 +499,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Captures a Range state. * * Returns: - * a copy of $(D this). + * a copy of `this`. */ @property typeof(this) save() @@ -646,7 +646,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Captures a Range state. * * Returns: - * a copy of $(D this). + * a copy of `this`. */ @property typeof(this) save() @@ -660,9 +660,9 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') /** - * Iterates through an $(D InputRange) at a time by using $(D Encoder). + * Iterates through an `InputRange` at a time by using `Encoder`. * - * Default $(D Encoder) encodes chunk data. + * Default `Encoder` encodes chunk data. * * Example: * ----- @@ -676,8 +676,8 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * } * ----- * - * In addition, You can use $(D Encoder) that returns encoded single character. - * This $(D Encoder) performs Range-based and lazy encoding. + * In addition, You can use `Encoder` that returns encoded single character. + * This `Encoder` performs Range-based and lazy encoding. * * Example: * ----- @@ -691,10 +691,10 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * ----- * * Params: - * range = an $(D InputRange) to iterate. + * range = an `InputRange` to iterate. * * Returns: - * a $(D Encoder) object instantiated and initialized according to the arguments. + * a `Encoder` object instantiated and initialized according to the arguments. */ Encoder!(Range) encoder(Range)(Range range) if (isInputRange!Range) { @@ -767,7 +767,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Decodes $(D_PARAM source) into $(D_PARAM buffer). * * Params: - * source = an $(D InputRange) to decode. + * source = an `InputRange` to decode. * buffer = a buffer to store decoded result. * * Returns: @@ -918,8 +918,8 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Decodes $(D_PARAM source) into $(D_PARAM range). * * Params: - * source = an $(D InputRange) to decode. - * range = an $(D OutputRange) to put decoded result + * source = an `InputRange` to decode. + * range = an `OutputRange` to put decoded result * * Returns: * the number of calling put. @@ -1156,7 +1156,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Captures a Range state. * * Returns: - * a copy of $(D this). + * a copy of `this`. */ @property typeof(this) save() @@ -1325,7 +1325,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * Captures a Range state. * * Returns: - * a copy of $(D this). + * a copy of `this`. */ @property typeof(this) save() @@ -1339,9 +1339,9 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') /** - * Iterates through an $(D InputRange) at a time by using $(D Decoder). + * Iterates through an `InputRange` at a time by using `Decoder`. * - * Default $(D Decoder) decodes chunk data. + * Default `Decoder` decodes chunk data. * * Example: * ----- @@ -1351,8 +1351,8 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * } * ----- * - * In addition, You can use $(D Decoder) that returns decoded single character. - * This $(D Decoder) performs Range-based and lazy decoding. + * In addition, You can use `Decoder` that returns decoded single character. + * This `Decoder` performs Range-based and lazy decoding. * * Example: * ----- @@ -1364,14 +1364,14 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') * ----- * * NOTE: - * If you use $(D ByChunk), chunk-size should be the multiple of 4. - * $(D Decoder) can't judge a encode-boundary. + * If you use `ByChunk`, chunk-size should be the multiple of 4. + * `Decoder` can't judge a encode-boundary. * * Params: - * range = an $(D InputRange) to iterate. + * range = an `InputRange` to iterate. * * Returns: - * a $(D Decoder) object instantiated and initialized according to the arguments. + * a `Decoder` object instantiated and initialized according to the arguments. */ Decoder!(Range) decoder(Range)(Range range) if (isInputRange!Range) { diff --git a/std/bigint.d b/std/bigint.d index 0efb33f5f73..48f2e348d72 100644 --- a/std/bigint.d +++ b/std/bigint.d @@ -571,13 +571,13 @@ unittest j ^^= 11; } -/** This function returns a $(D string) representation of a $(D BigInt). +/** This function returns a `string` representation of a `BigInt`. Params: - x = The $(D BigInt) to convert to a decimal $(D string). + x = The `BigInt` to convert to a decimal `string`. Returns: - A $(D string) that represents the $(D BigInt) as a decimal number. + A `string` that represents the `BigInt` as a decimal number. */ string toDecimalString(const(BigInt) x) @@ -588,13 +588,13 @@ string toDecimalString(const(BigInt) x) return outbuff; } -/** This function returns a $(D string) representation of a $(D BigInt). +/** This function returns a `string` representation of a `BigInt`. Params: - x = The $(D BigInt) to convert to a hexadecimal $(D string). + x = The `BigInt` to convert to a hexadecimal `string`. Returns: - A $(D string) that represents the $(D BigInt) as a hexadecimal number. + A `string` that represents the `BigInt` as a hexadecimal number. */ string toHex(const(BigInt) x) diff --git a/std/bitmanip.d b/std/bitmanip.d index 952776e0f3c..a2d4e092108 100644 --- a/std/bitmanip.d +++ b/std/bitmanip.d @@ -264,10 +264,10 @@ For example, a pointer to an integer must be 4-byte aligned, so there are 2 bits One can store a 2-bit integer there. The example above creates a tagged pointer in the struct A. The pointer is of type -$(D uint*) as specified by the first argument, and is named x, as specified by the second +`uint*` as specified by the first argument, and is named x, as specified by the second argument. -Following arguments works the same way as $(D bitfield)'s. The bitfield must fit into the +Following arguments works the same way as `bitfield`'s. The bitfield must fit into the bits known to be zero because of the pointer alignement. */ @@ -300,7 +300,7 @@ For example, a pointer to an integer must be 4-byte aligned, so there are 2 bits One can store a 2-bit integer there. The example above creates a tagged reference to an Object in the struct A. This expects the same parameters -as $(D taggedPointer), except the first argument which must be a class type instead of a pointer type. +as `taggedPointer`, except the first argument which must be a class type instead of a pointer type. */ template taggedClassRef(T, string name, Ts...) if(is(T == class)) { @@ -730,7 +730,7 @@ private: public: /********************************************** - * Gets the amount of native words backing this $(D BitArray). + * Gets the amount of native words backing this `BitArray`. */ @property size_t dim() const @nogc pure nothrow { @@ -738,7 +738,7 @@ public: } /********************************************** - * Gets the amount of bits in the $(D BitArray). + * Gets the amount of bits in the `BitArray`. */ @property size_t length() const @nogc pure nothrow { @@ -746,7 +746,7 @@ public: } /********************************************** - * Sets the amount of bits in the $(D BitArray). + * Sets the amount of bits in the `BitArray`. * $(RED Warning: increasing length may overwrite bits in * final word up to the next word boundary. i.e. D dynamic * array extension semantics are not followed.) @@ -772,7 +772,7 @@ public: } /********************************************** - * Gets the $(D i)'th bit in the $(D BitArray). + * Gets the `i`'th bit in the `BitArray`. */ bool opIndex(size_t i) const @nogc pure nothrow in @@ -800,7 +800,7 @@ public: } /********************************************** - * Sets the $(D i)'th bit in the $(D BitArray). + * Sets the `i`'th bit in the `BitArray`. */ bool opIndexAssign(bool b, size_t i) @nogc pure nothrow in @@ -817,7 +817,7 @@ public: } /********************************************** - * Duplicates the $(D BitArray) and its contents. + * Duplicates the `BitArray` and its contents. */ @property BitArray dup() const pure nothrow { @@ -848,7 +848,7 @@ public: } /********************************************** - * Support for $(D foreach) loops for $(D BitArray). + * Support for `foreach` loops for `BitArray`. */ int opApply(scope int delegate(ref bool) dg) { @@ -946,7 +946,7 @@ public: /********************************************** - * Reverses the bits of the $(D BitArray). + * Reverses the bits of the `BitArray`. */ @property BitArray reverse() @nogc pure nothrow out (result) @@ -990,7 +990,7 @@ public: /********************************************** - * Sorts the $(D BitArray)'s elements. + * Sorts the `BitArray`'s elements. */ @property BitArray sort() @nogc pure nothrow out (result) @@ -1051,7 +1051,7 @@ public: /*************************************** - * Support for operators == and != for $(D BitArray). + * Support for operators == and != for `BitArray`. */ bool opEquals(const ref BitArray a2) const @nogc pure nothrow { @@ -1098,7 +1098,7 @@ public: } /*************************************** - * Supports comparison operators for $(D BitArray). + * Supports comparison operators for `BitArray`. */ int opCmp(BitArray a2) const @nogc pure nothrow { @@ -1199,7 +1199,7 @@ public: } /*************************************** - * Support for hashing for $(D BitArray). + * Support for hashing for `BitArray`. */ size_t toHash() const @nogc pure nothrow { @@ -1235,7 +1235,7 @@ public: } /*************************************** - * Set this $(D BitArray) to the contents of $(D ba). + * Set this `BitArray` to the contents of `ba`. */ this(bool[] ba) pure nothrow { @@ -1254,12 +1254,12 @@ public: } /*************************************** - * Map the $(D BitArray) onto $(D v), with $(D numbits) being the number of bits - * in the array. Does not copy the data. $(D v.length) must be a multiple of + * Map the `BitArray` onto `v`, with `numbits` being the number of bits + * in the array. Does not copy the data. `v.length` must be a multiple of * $(D size_t.sizeof). If there are unmapped bits in the final mapped word then * these will be set to 0. * - * This is the inverse of $(D opCast). + * This is the inverse of `opCast`. * $(RED Will be deprecated in 2.068. Please use the constructor instead.) */ this(void[] v, size_t numbits) pure nothrow @@ -1304,7 +1304,7 @@ public: } /*************************************** - * Convert to $(D void[]). + * Convert to `void[]`. */ void[] opCast(T : void[])() @nogc pure nothrow { @@ -1332,7 +1332,7 @@ public: } /*************************************** - * Support for unary operator ~ for $(D BitArray). + * Support for unary operator ~ for `BitArray`. */ BitArray opCom() const pure nothrow { @@ -1369,7 +1369,7 @@ public: /*************************************** - * Support for binary bitwise operators for $(D BitArray). + * Support for binary bitwise operators for `BitArray`. */ BitArray opBinary(string op)(const BitArray e2) const pure nothrow if (op == "-" || op == "&" || op == "|" || op == "^") @@ -1475,7 +1475,7 @@ public: /*************************************** - * Support for operator op= for $(D BitArray). + * Support for operator op= for `BitArray`. */ BitArray opOpAssign(string op)(const BitArray e2) @nogc pure nothrow if (op == "-" || op == "&" || op == "|" || op == "^") @@ -1595,7 +1595,7 @@ public: } /*************************************** - * Support for operator ~= for $(D BitArray). + * Support for operator ~= for `BitArray`. * $(RED Warning: This will overwrite a bit in the final word * of the current underlying data regardless of whether it is * shared between BitArray objects. i.e. D dynamic array @@ -1665,7 +1665,7 @@ public: } /*************************************** - * Support for binary operator ~ for $(D BitArray). + * Support for binary operator ~ for `BitArray`. */ BitArray opCat(bool b) const pure nothrow { @@ -1800,7 +1800,7 @@ public: } /** - * Operator $(D <<=) support. + * Operator `<<=` support. * * Shifts all the bits in the array to the left by the given number of * bits. The leftmost bits are dropped, and 0's are appended to the end @@ -1834,7 +1834,7 @@ public: } /** - * Operator $(D >>=) support. + * Operator `>>=` support. * * Shifts all the bits in the array to the right by the given number of * bits. The rightmost bits are dropped, and 0's are inserted at the back @@ -2224,14 +2224,14 @@ private union EndianSwapper(T) /++ Converts the given value from the native endianness to big endian and - returns it as a $(D ubyte[n]) where $(D n) is the size of the given type. + returns it as a `ubyte[n]` where `n` is the size of the given type. - Returning a $(D ubyte[n]) helps prevent accidentally using a swapped value + Returning a `ubyte[n]` helps prevent accidentally using a swapped value as a regular one (and in the case of floating point values, it's necessary, because the FPU will mess up any swapped floating point values. So, you can't actually have swapped floating point values as floating point values). - $(D real) is not supported, because its size is implementation-dependent + `real` is not supported, because its size is implementation-dependent and therefore could vary from machine to machine (which could make it unusable if you tried to transfer it to another machine). +/ @@ -2347,12 +2347,12 @@ unittest /++ Converts the given value from big endian to the native endianness and - returns it. The value is given as a $(D ubyte[n]) where $(D n) is the size + returns it. The value is given as a `ubyte[n]` where `n` is the size of the target type. You must give the target type as a template argument, because there are multiple types with the same size and so the type of the argument is not enough to determine the return type. - Taking a $(D ubyte[n]) helps prevent accidentally using a swapped value + Taking a `ubyte[n]` helps prevent accidentally using a swapped value as a regular one (and in the case of floating point values, it's necessary, because the FPU will mess up any swapped floating point values. So, you can't actually have swapped floating point values as floating point values). @@ -2402,9 +2402,9 @@ private T bigEndianToNativeImpl(T, size_t n)(ubyte[n] val) @safe pure nothrow @n /++ Converts the given value from the native endianness to little endian and - returns it as a $(D ubyte[n]) where $(D n) is the size of the given type. + returns it as a `ubyte[n]` where `n` is the size of the given type. - Returning a $(D ubyte[n]) helps prevent accidentally using a swapped value + Returning a `ubyte[n]` helps prevent accidentally using a swapped value as a regular one (and in the case of floating point values, it's necessary, because the FPU will mess up any swapped floating point values. So, you can't actually have swapped floating point values as floating point values). @@ -2490,17 +2490,17 @@ unittest /++ Converts the given value from little endian to the native endianness and - returns it. The value is given as a $(D ubyte[n]) where $(D n) is the size + returns it. The value is given as a `ubyte[n]` where `n` is the size of the target type. You must give the target type as a template argument, because there are multiple types with the same size and so the type of the argument is not enough to determine the return type. - Taking a $(D ubyte[n]) helps prevent accidentally using a swapped value + Taking a `ubyte[n]` helps prevent accidentally using a swapped value as a regular one (and in the case of floating point values, it's necessary, because the FPU will mess up any swapped floating point values. So, you can't actually have swapped floating point values as floating point values). - $(D real) is not supported, because its size is implementation-dependent + `real` is not supported, because its size is implementation-dependent and therefore could vary from machine to machine (which could make it unusable if you tried to transfer it to another machine). +/ @@ -2635,18 +2635,18 @@ unittest } /++ - Takes a range of $(D ubyte)s and converts the first $(D T.sizeof) bytes to - $(D T). The value returned is converted from the given endianness to the + Takes a range of `ubyte`s and converts the first `T.sizeof` bytes to + `T`. The value returned is converted from the given endianness to the native endianness. The range is not consumed. Params: - T = The integral type to convert the first $(D T.sizeof) bytes to. + T = The integral type to convert the first `T.sizeof` bytes to. endianness = The endianness that the bytes are assumed to be in. range = The range to read from. index = The index to start reading from (instead of starting at the front). If index is a pointer, then it is updated to the index after the bytes read. The overloads with index are only - available if $(D hasSlicing!R) is $(D true). + available if `hasSlicing!R` is `true`. +/ T peek(T, Endian endianness = Endian.bigEndian, R)(R range) @@ -2941,13 +2941,13 @@ unittest /++ - Takes a range of $(D ubyte)s and converts the first $(D T.sizeof) bytes to - $(D T). The value returned is converted from the given endianness to the - native endianness. The $(D T.sizeof) bytes which are read are consumed from + Takes a range of `ubyte`s and converts the first `T.sizeof` bytes to + `T`. The value returned is converted from the given endianness to the + native endianness. The `T.sizeof` bytes which are read are consumed from the range. Params: - T = The integral type to convert the first $(D T.sizeof) bytes to. + T = The integral type to convert the first `T.sizeof` bytes to. endianness = The endianness that the bytes are assumed to be in. range = The range to read from. +/ @@ -3185,11 +3185,11 @@ unittest /++ Takes an integral value, converts it to the given endianness, and writes it - to the given range of $(D ubyte)s as a sequence of $(D T.sizeof) $(D ubyte)s - starting at index. $(D hasSlicing!R) must be $(D true). + to the given range of `ubyte`s as a sequence of `T.sizeof` `ubyte`s + starting at index. `hasSlicing!R` must be `true`. Params: - T = The integral type to convert the first $(D T.sizeof) bytes to. + T = The integral type to convert the first `T.sizeof` bytes to. endianness = The endianness to write the bytes in. range = The range to write to. index = The index to start writing to. If index is a pointer, then it @@ -3529,12 +3529,12 @@ unittest /++ Takes an integral value, converts it to the given endianness, and appends - it to the given range of $(D ubyte)s (using $(D put)) as a sequence of - $(D T.sizeof) $(D ubyte)s starting at index. $(D hasSlicing!R) must be - $(D true). + it to the given range of `ubyte`s (using `put`) as a sequence of + `T.sizeof` `ubyte`s starting at index. `hasSlicing!R` must be + `true`. Params: - T = The integral type to convert the first $(D T.sizeof) bytes to. + T = The integral type to convert the first `T.sizeof` bytes to. endianness = The endianness to write the bytes in. range = The range to append to. +/ @@ -3736,7 +3736,7 @@ unittest } /** -Counts the number of trailing zeros in the binary representation of $(D value). +Counts the number of trailing zeros in the binary representation of `value`. For signed integers, the sign bit is included in the count. */ private uint countTrailingZeros(T)(T value) @nogc pure nothrow @@ -3800,7 +3800,7 @@ unittest } /** -Counts the number of set bits in the binary representation of $(D value). +Counts the number of set bits in the binary representation of `value`. For signed integers, the sign bit is included in the count. */ private uint countBitsSet(T)(T value) @nogc pure nothrow @@ -3929,7 +3929,7 @@ private struct BitsSet(T) } /** -Range that iterates the indices of the set bits in $(D value). +Range that iterates the indices of the set bits in `value`. Index 0 corresponds to the least significant bit. For signed integers, the highest index corresponds to the sign bit. */ diff --git a/std/c/fenv.d b/std/c/fenv.d index d574a726316..62c39262be0 100644 --- a/std/c/fenv.d +++ b/std/c/fenv.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.fenv) instead. This module will + * $(RED Deprecated. Please use `core.stdc.fenv` instead. This module will * be removed in December 2015.) * C's <fenv.h> * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com diff --git a/std/c/linux/tipc.d b/std/c/linux/tipc.d index c17dec52f25..212d7472cc3 100644 --- a/std/c/linux/tipc.d +++ b/std/c/linux/tipc.d @@ -1,5 +1,5 @@ /** - * $(RED Deprecated. Please use $(D core.sys.linux.tipc) instead. This module + * $(RED Deprecated. Please use `core.sys.linux.tipc` instead. This module * will be removed in December 2015.) * Interface for Linux TIPC sockets, /usr/include/linux/tipc.h * diff --git a/std/c/locale.d b/std/c/locale.d index b2d5eb207d8..4b4cfc57533 100644 --- a/std/c/locale.d +++ b/std/c/locale.d @@ -1,5 +1,5 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.locale) instead. This module will + * $(RED Deprecated. Please use `core.stdc.locale` instead. This module will * be removed in December 2015.) * C's <locale.h> * License: Public Domain diff --git a/std/c/math.d b/std/c/math.d index d179237c6b1..ef2080b2c71 100644 --- a/std/c/math.d +++ b/std/c/math.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.math) instead. This module will + * $(RED Deprecated. Please use `core.stdc.math` instead. This module will * be removed in December 2015.) * C's <math.h> * Authors: Walter Bright, Digital Mars, www.digitalmars.com diff --git a/std/c/process.d b/std/c/process.d index 6aafec6fc20..463ed5e8c80 100644 --- a/std/c/process.d +++ b/std/c/process.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.stdlib) or the core.sys.posix.* + * $(RED Deprecated. Please use `core.stdc.stdlib` or the core.sys.posix.* * modules you need instead. This module will be removed in December 2015.) * C's <process.h> * Authors: Walter Bright, Digital Mars, www.digitalmars.com diff --git a/std/c/stdarg.d b/std/c/stdarg.d index e82a357abe0..11689a102e1 100644 --- a/std/c/stdarg.d +++ b/std/c/stdarg.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.stdarg) instead. This module will + * $(RED Deprecated. Please use `core.stdc.stdarg` instead. This module will * be removed in December 2015.) * C's <stdarg.h> * Authors: Hauke Duden and Walter Bright, Digital Mars, www.digitalmars.com diff --git a/std/c/stddef.d b/std/c/stddef.d index 4eb74cff70c..42e28fc9867 100644 --- a/std/c/stddef.d +++ b/std/c/stddef.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.stddef) instead. This module will + * $(RED Deprecated. Please use `core.stdc.stddef` instead. This module will * be removed in December 2015.) * C's <stddef.h> * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com diff --git a/std/c/stdio.d b/std/c/stdio.d index 95fcdfefd97..57fe50442d8 100644 --- a/std/c/stdio.d +++ b/std/c/stdio.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.stdio) instead. This module will + * $(RED Deprecated. Please use `core.stdc.stdio` instead. This module will * be removed in December 2015.) * C's <stdio.h> for the D programming language * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com diff --git a/std/c/stdlib.d b/std/c/stdlib.d index 412d94f39e1..d7482db9ce0 100644 --- a/std/c/stdlib.d +++ b/std/c/stdlib.d @@ -1,5 +1,5 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.stdlib) or $(D core.sys.posix.stdlib) + * $(RED Deprecated. Please use `core.stdc.stdlib` or `core.sys.posix.stdlib` * instead. This module will be removed in December 2015.) * C's <stdlib.h> * D Programming Language runtime library diff --git a/std/c/string.d b/std/c/string.d index cfd5c00771c..baf81f29d60 100644 --- a/std/c/string.d +++ b/std/c/string.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.string) instead. This module will + * $(RED Deprecated. Please use `core.stdc.string` instead. This module will * be removed in December 2015.) * C's <string.h> * Authors: Walter Bright, Digital Mars, http://www.digitalmars.com diff --git a/std/c/time.d b/std/c/time.d index 24e5bc79064..2295a751549 100644 --- a/std/c/time.d +++ b/std/c/time.d @@ -1,6 +1,6 @@ /** - * $(RED Deprecated. Please use $(D core.stdc.time) instead. This module will + * $(RED Deprecated. Please use `core.stdc.time` instead. This module will * be removed in December 2015.) * C's <time.h> * Authors: Walter Bright, Digital Mars, www.digitalmars.com diff --git a/std/complex.d b/std/complex.d index 10e2caadf3f..8900c758028 100644 --- a/std/complex.d +++ b/std/complex.d @@ -4,8 +4,8 @@ _complex numbers, along with related mathematical operations and functions. $(LREF Complex) will eventually $(LINK2 ../deprecate.html, replace) - the built-in types $(D cfloat), $(D cdouble), $(D creal), $(D ifloat), - $(D idouble), and $(D ireal). + the built-in types `cfloat`, `cdouble`, `creal`, `ifloat`, + `idouble`, and `ireal`. Authors: Lars Tandle Kyllingstad, Don Clugston Copyright: Copyright (c) 2010, Lars T. Kyllingstad. @@ -19,8 +19,8 @@ import std.traits; /** Helper function that returns a _complex number with the specified real and imaginary parts. - If neither $(D re) nor $(D im) are floating-point numbers, this - function returns a $(D Complex!double). Otherwise, the return type + If neither `re` nor `im` are floating-point numbers, this + function returns a `Complex!double`. Otherwise, the return type is deduced using $(D std.traits.CommonType!(R, I)). */ auto complex(T)(T re) @safe pure nothrow @nogc if (is(T : double)) @@ -81,8 +81,8 @@ unittest } -/** A complex number parametrised by a type $(D T), which must be either - $(D float), $(D double) or $(D real). +/** A complex number parametrised by a type `T`, which must be either + `float`, `double` or `real`. */ struct Complex(T) if (isFloatingPoint!T) { @@ -656,7 +656,7 @@ unittest /++ Calculates the squared modulus of a complex number. - For genericity, if called on a real number, $(D sqAbs) returns its square. + For genericity, if called on a real number, `sqAbs` returns its square. +/ T sqAbs(T)(Complex!T z) @safe pure nothrow @nogc { @@ -774,7 +774,7 @@ unittest{ /** Calculates cos(y) + i sin(y). Note: - $(D expi) is included here for convenience and for easy migration of code + `expi` is included here for convenience and for easy migration of code that uses $(XREF math,_expi). Unlike $(XREF math,_expi), which uses the x87 $(I fsincos) instruction when possible, this function is no faster than calculating cos(y) and sin(y) separately. diff --git a/std/concurrency.d b/std/concurrency.d index df44262a153..f46dd3cc543 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -214,7 +214,7 @@ static ~this() /** - * Thrown on calls to $(D receiveOnly) if a message other than the type + * Thrown on calls to `receiveOnly` if a message other than the type * the receiving thread expected is sent. */ class MessageMismatch : Exception @@ -227,7 +227,7 @@ class MessageMismatch : Exception /** - * Thrown on calls to $(D receive) if the thread that spawned the receiving + * Thrown on calls to `receive` if the thread that spawned the receiving * thread has terminated and no more messages exist. */ class OwnerTerminated : Exception @@ -279,7 +279,7 @@ class PriorityMessageException : Exception /** * Thrown on mailbox crowding if the mailbox is configured with - * $(D OnCrowding.throwException). + * `OnCrowding.throwException`. */ class MailboxFull : Exception { @@ -294,7 +294,7 @@ class MailboxFull : Exception /** - * Thrown when a Tid is missing, e.g. when $(D ownerTid) doesn't + * Thrown when a Tid is missing, e.g. when `ownerTid` doesn't * find an owner thread. */ class TidMissingException : Exception @@ -363,7 +363,7 @@ public: /** * Return the Tid of the thread which spawned the caller's thread. * - * Throws: A $(D TidMissingException) exception if + * Throws: A `TidMissingException` exception if * there is no owner thread. */ @property Tid ownerTid() @@ -419,10 +419,10 @@ private template isSpawnable(F, T...) * Starts fn(args) in a new logical thread. * * Executes the supplied function in a new logical thread represented by - * $(D Tid). The calling thread is designated as the owner of the new thread. - * When the owner thread terminates an $(D OwnerTerminated) message will be - * sent to the new thread, causing an $(D OwnerTerminated) exception to be - * thrown on $(D receive()). + * `Tid`. The calling thread is designated as the owner of the new thread. + * When the owner thread terminates an `OwnerTerminated` message will be + * sent to the new thread, causing an `OwnerTerminated` exception to be + * thrown on `receive()`. * * Params: * fn = The function to execute. @@ -432,8 +432,8 @@ private template isSpawnable(F, T...) * A Tid representing the new logical thread. * * Notes: - * $(D args) must not have unshared aliasing. In other words, all arguments - * to $(D fn) must either be $(D shared) or $(D immutable) or have no + * `args` must not have unshared aliasing. In other words, all arguments + * to `fn` must either be `shared` or `immutable` or have no * pointer indirection. This is necessary for enforcing isolation among * threads. * @@ -585,7 +585,7 @@ unittest * Places the values as a message at the back of tid's message queue. * * Sends the supplied value to the thread represented by tid. As with - * $(XREF concurrency, spawn), $(D T) must not have unshared aliasing. + * $(XREF concurrency, spawn), `T` must not have unshared aliasing. */ void send(T...)( Tid tid, T vals ) { @@ -598,7 +598,7 @@ void send(T...)( Tid tid, T vals ) /** * Places the values as a message on the front of tid's message queue. * - * Send a message to $(D tid) but place it at the front of $(D tid)'s message + * Send a message to `tid` but place it at the front of `tid`'s message * queue instead of at the back. This function is typically used for * out-of-band communication, to signal exceptional conditions, etc. */ @@ -638,9 +638,9 @@ private void _send(T...)( MsgType type, Tid tid, T vals ) * a message against a set of delegates and executing the first match found. * * If a delegate that accepts a $(XREF variant, Variant) is included as - * the last argument to $(D receive), it will match any message that was not + * the last argument to `receive`, it will match any message that was not * matched by an earlier delegate. If more than one argument is sent, - * the $(D Variant) will contain a $(XREF typecons, Tuple) of all values + * the `Variant` will contain a $(XREF typecons, Tuple) of all values * sent. * * Example: @@ -723,12 +723,12 @@ private template receiveOnlyRet(T...) } /** - * Receives only messages with arguments of types $(D T). + * Receives only messages with arguments of types `T`. * - * Throws: $(D MessageMismatch) if a message of types other than $(D T) + * Throws: `MessageMismatch` if a message of types other than `T` * is received. * - * Returns: The received message. If $(D T.length) is greater than one, + * Returns: The received message. If `T.length` is greater than one, * the message will be packed into a $(XREF typecons, Tuple). * * Example: @@ -815,10 +815,10 @@ unittest /** * Tries to receive but will give up if no matches arrive within duration. * - * Same as $(D receive) except that rather than wait forever for a message, + * Same as `receive` except that rather than wait forever for a message, * it waits until either it receives a message or the given - * $(CXREF time, Duration) has passed. It returns $(D true) if it received a - * message and $(D false) if it timed out waiting for one. + * $(CXREF time, Duration) has passed. It returns `true` if it received a + * message and `false` if it timed out waiting for one. */ bool receiveTimeout(T...)( Duration duration, T ops ) in diff --git a/std/container/array.d b/std/container/array.d index e5276af9307..86b50ba04b7 100644 --- a/std/container/array.d +++ b/std/container/array.d @@ -1,5 +1,5 @@ /** -This module provides an $(D Array) type with deterministic memory usage not +This module provides an `Array` type with deterministic memory usage not reliant on the GC, as an alternative to the built-in arrays. This module is a submodule of $(LINK2 std_container_package.html, std.container). @@ -29,19 +29,19 @@ public import std.container.util; /** Array type with deterministic control of memory. The memory allocated for the array is reclaimed as soon as possible; there is no reliance -on the garbage collector. $(D Array) uses $(D malloc) and $(D free) +on the garbage collector. `Array` uses `malloc` and `free` for managing its own memory. -This means that pointers to elements of an $(D Array) will become -dangling as soon as the element is removed from the $(D Array). On the other hand -the memory allocated by an $(D Array) will be scanned by the GC and -GC managed objects referenced from an $(D Array) will be kept alive. +This means that pointers to elements of an `Array` will become +dangling as soon as the element is removed from the `Array`. On the other hand +the memory allocated by an `Array` will be scanned by the GC and +GC managed objects referenced from an `Array` will be kept alive. Note: -When using $(D Array) with range-based functions like those in $(D std.algorithm), -$(D Array) must be sliced to get a range (for example, use $(D array[].map!) -instead of $(D array.map!)). The container itself is not a range. +When using `Array` with range-based functions like those in `std.algorithm`, +`Array` must be sliced to get a range (for example, use `array[].map!` +instead of `array.map!`). The container itself is not a range. */ struct Array(T) if (!is(Unqual!T == bool)) @@ -400,7 +400,7 @@ Complexity: $(BIGOH n). } /** -Property returning $(D true) if and only if the container has no +Property returning `true` if and only if the container has no elements. Complexity: $(BIGOH 1) @@ -438,7 +438,7 @@ Complexity: $(BIGOH 1) } /** -Ensures sufficient capacity to accommodate $(D e) elements. +Ensures sufficient capacity to accommodate `e` elements. Postcondition: $(D capacity >= e) @@ -477,7 +477,7 @@ Complexity: $(BIGOH 1) /** Returns a range that iterates over elements of the container from -index $(D a) up to (excluding) index $(D b). +index `a` up to (excluding) index `b`. Precondition: $(D a <= b && b <= length) @@ -490,9 +490,9 @@ Complexity: $(BIGOH 1) } /** -Forward to $(D opSlice().front) and $(D opSlice().back), respectively. +Forward to `opSlice().front` and `opSlice().back`, respectively. -Precondition: $(D !empty) +Precondition: `!empty` Complexity: $(BIGOH 1) */ @@ -575,9 +575,9 @@ Complexity: $(BIGOH slice.length) } /** -Returns a new container that's the concatenation of $(D this) and its -argument. $(D opBinaryRight) is only defined if $(D Stuff) does not -define $(D opBinary). +Returns a new container that's the concatenation of `this` and its +argument. `opBinaryRight` is only defined if `Stuff` does not +define `opBinary`. Complexity: $(BIGOH n + m), where m is the number of elements in $(D stuff) @@ -596,7 +596,7 @@ stuff) } /** -Forwards to $(D insertBack(stuff)). +Forwards to `insertBack(stuff)`. */ void opOpAssign(string op, Stuff)(Stuff stuff) if (op == "~") @@ -615,7 +615,7 @@ Forwards to $(D insertBack(stuff)). Removes all contents from the container. The container decides how $(D capacity) is affected. -Postcondition: $(D empty) +Postcondition: `empty` Complexity: $(BIGOH n) */ @@ -625,8 +625,8 @@ Complexity: $(BIGOH n) } /** -Sets the number of elements in the container to $(D newSize). If $(D -newSize) is greater than $(D length), the added elements are added to +Sets the number of elements in the container to `newSize`. If $(D +newSize) is greater than `length`, the added elements are added to unspecified positions in the container and initialized with $(D T.init). @@ -645,7 +645,7 @@ Picks one value in an unspecified position in the container, removes it from the container, and returns it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. -Precondition: $(D !empty) +Precondition: `!empty` Returns: The element removed. @@ -661,15 +661,15 @@ Complexity: $(BIGOH log(n)). alias stableRemoveAny = removeAny; /** -Inserts $(D value) to the front or back of the container. $(D stuff) -can be a value convertible to $(D T) or a range of objects convertible -to $(D T). The stable version behaves the same, but guarantees that +Inserts `value` to the front or back of the container. `stuff` +can be a value convertible to `T` or a range of objects convertible +to `T`. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: The number of elements inserted -Complexity: $(BIGOH m * log(n)), where $(D m) is the number of -elements in $(D stuff) +Complexity: $(BIGOH m * log(n)), where `m` is the number of +elements in `stuff` */ size_t insertBack(Stuff)(Stuff stuff) if (isImplicitlyConvertible!(Stuff, T) || @@ -686,7 +686,7 @@ Removes the value at the back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. -Precondition: $(D !empty) +Precondition: `!empty` Complexity: $(BIGOH log(n)). */ @@ -702,9 +702,9 @@ Complexity: $(BIGOH log(n)). alias stableRemoveBack = removeBack; /** -Removes $(D howMany) values at the front or back of the +Removes `howMany` values at the front or back of the container. Unlike the unparameterized versions above, these functions -do not throw if they could not remove $(D howMany) elements. Instead, +do not throw if they could not remove `howMany` elements. Instead, if $(D howMany > n), all elements are removed. The returned value is the effective number of elements removed. The stable version behaves the same, but guarantees that ranges iterating over the container are @@ -728,15 +728,15 @@ Complexity: $(BIGOH howMany). alias stableRemoveBack = removeBack; /** -Inserts $(D stuff) before, after, or instead range $(D r), which must -be a valid range previously extracted from this container. $(D stuff) -can be a value convertible to $(D T) or a range of objects convertible -to $(D T). The stable version behaves the same, but guarantees that +Inserts `stuff` before, after, or instead range `r`, which must +be a valid range previously extracted from this container. `stuff` +can be a value convertible to `T` or a range of objects convertible +to `T`. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: The number of values inserted. -Complexity: $(BIGOH n + m), where $(D m) is the length of $(D stuff) +Complexity: $(BIGOH n + m), where `m` is the length of `stuff` */ size_t insertBefore(Stuff)(Range r, Stuff stuff) if (isImplicitlyConvertible!(Stuff, T)) @@ -849,16 +849,16 @@ Complexity: $(BIGOH n + m), where $(D m) is the length of $(D stuff) } /** -Removes all elements belonging to $(D r), which must be a range +Removes all elements belonging to `r`, which must be a range obtained originally from this container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: A range spanning the remaining elements in the container that -initially were right after $(D r). +initially were right after `r`. -Complexity: $(BIGOH n - m), where $(D m) is the number of elements in -$(D r) +Complexity: $(BIGOH n - m), where `m` is the number of elements in +`r` */ Range linearRemove(Range r) { @@ -1248,7 +1248,7 @@ unittest //6998-2 //////////////////////////////////////////////////////////////////////////////// /** -_Array specialized for $(D bool). Packs together values efficiently by +_Array specialized for `bool`. Packs together values efficiently by allocating one bit per element. */ struct Array(T) @@ -1375,7 +1375,7 @@ if (is(Unqual!T == bool)) } /** - Property returning $(D true) if and only if the container has + Property returning `true` if and only if the container has no elements. Complexity: $(BIGOH 1) @@ -1467,7 +1467,7 @@ if (is(Unqual!T == bool)) } /** - Ensures sufficient capacity to accommodate $(D n) elements. + Ensures sufficient capacity to accommodate `n` elements. Postcondition: $(D capacity >= n) @@ -1529,7 +1529,7 @@ if (is(Unqual!T == bool)) } /** - Equivalent to $(D opSlice().front) and $(D opSlice().back), + Equivalent to `opSlice().front` and `opSlice().back`, respectively. Complexity: $(BIGOH log(n)) @@ -1639,11 +1639,11 @@ if (is(Unqual!T == bool)) } /** - Returns a new container that's the concatenation of $(D this) + Returns a new container that's the concatenation of `this` and its argument. Complexity: $(BIGOH n + m), where m is the number of elements - in $(D stuff) + in `stuff` */ Array!bool opBinary(string op, Stuff)(Stuff rhs) if (op == "~") { @@ -1695,9 +1695,9 @@ if (is(Unqual!T == bool)) /** Removes all contents from the container. The container decides - how $(D capacity) is affected. + how `capacity` is affected. - Postcondition: $(D empty) + Postcondition: `empty` Complexity: $(BIGOH n) */ @@ -1716,9 +1716,9 @@ if (is(Unqual!T == bool)) /** Sets the number of elements in the container to $(D - newSize). If $(D newSize) is greater than $(D length), the + newSize). If `newSize` is greater than `length`, the added elements are added to the container and initialized with - $(D ElementType.init). + `ElementType.init`. Complexity: $(BIGOH abs(n - newLength)) @@ -1746,25 +1746,25 @@ if (is(Unqual!T == bool)) } /** - Inserts $(D stuff) in the container. $(D stuff) can be a value - convertible to $(D ElementType) or a range of objects - convertible to $(D ElementType). + Inserts `stuff` in the container. `stuff` can be a value + convertible to `ElementType` or a range of objects + convertible to `ElementType`. - The $(D stable) version guarantees that ranges iterating over + The `stable` version guarantees that ranges iterating over the container are never invalidated. Client code that counts on - non-invalidating insertion should use $(D stableInsert). + non-invalidating insertion should use `stableInsert`. Returns: The number of elements added. - Complexity: $(BIGOH m * log(n)), where $(D m) is the number of - elements in $(D stuff) + Complexity: $(BIGOH m * log(n)), where `m` is the number of + elements in `stuff` */ alias insert = insertBack; ///ditto alias stableInsert = insertBack; /** - Same as $(D insert(stuff)) and $(D stableInsert(stuff)) + Same as `insert(stuff)` and `stableInsert(stuff)` respectively, but relax the complexity constraint to linear. */ alias linearInsert = insertBack; @@ -1777,7 +1777,7 @@ if (is(Unqual!T == bool)) but guarantees that ranges iterating over the container are never invalidated. - Precondition: $(D !empty) + Precondition: `!empty` Returns: The element removed. @@ -1805,9 +1805,9 @@ if (is(Unqual!T == bool)) } /** - Inserts $(D value) to the back of the container. $(D stuff) can - be a value convertible to $(D ElementType) or a range of - objects convertible to $(D ElementType). The stable version + Inserts `value` to the back of the container. `stuff` can + be a value convertible to `ElementType` or a range of + objects convertible to `ElementType`. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. @@ -1859,11 +1859,11 @@ if (is(Unqual!T == bool)) Removes the value at the front or back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. The - optional parameter $(D howMany) instructs removal of that many + optional parameter `howMany` instructs removal of that many elements. If $(D howMany > n), all elements are removed and no exception is thrown. - Precondition: $(D !empty) + Precondition: `!empty` Complexity: $(BIGOH log(n)). */ @@ -1886,9 +1886,9 @@ if (is(Unqual!T == bool)) alias stableRemoveBack = removeBack; /** - Removes $(D howMany) values at the front or back of the + Removes `howMany` values at the front or back of the container. Unlike the unparameterized versions above, these - functions do not throw if they could not remove $(D howMany) + functions do not throw if they could not remove `howMany` elements. Instead, if $(D howMany > n), all elements are removed. The returned value is the effective number of elements removed. The stable version behaves the same, but guarantees @@ -1926,9 +1926,9 @@ if (is(Unqual!T == bool)) } /** - Inserts $(D stuff) before, after, or instead range $(D r), + Inserts `stuff` before, after, or instead range `r`, which must be a valid range previously extracted from this - container. $(D stuff) can be a value convertible to $(D + container. `stuff` can be a value convertible to $(D ElementType) or a range of objects convertible to $(D ElementType). The stable version behaves the same, but guarantees that ranges iterating over the container are never @@ -1936,7 +1936,7 @@ if (is(Unqual!T == bool)) Returns: The number of values inserted. - Complexity: $(BIGOH n + m), where $(D m) is the length of $(D stuff) + Complexity: $(BIGOH n + m), where `m` is the length of `stuff` */ size_t insertBefore(Stuff)(Range r, Stuff stuff) { @@ -2021,13 +2021,13 @@ if (is(Unqual!T == bool)) } /** - Removes all elements belonging to $(D r), which must be a range + Removes all elements belonging to `r`, which must be a range obtained originally from this container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: A range spanning the remaining elements in the container that - initially were right after $(D r). + initially were right after `r`. Complexity: $(BIGOH n) */ diff --git a/std/container/binaryheap.d b/std/container/binaryheap.d index 1324775b877..2638ae309af 100644 --- a/std/container/binaryheap.d +++ b/std/container/binaryheap.d @@ -1,5 +1,5 @@ /** -This module provides a $(D BinaryHeap) adaptor that makes a binary heap out of +This module provides a `BinaryHeap` adaptor that makes a binary heap out of any user-provided random-access range. This module is a submodule of $(LINK2 std_container_package.html, std.container). @@ -29,29 +29,29 @@ public import std.container.util; /** Implements a $(WEB en.wikipedia.org/wiki/Binary_heap, binary heap) container on top of a given random-access range type (usually $(D -T[])) or a random-access container type (usually $(D Array!T)). The -documentation of $(D BinaryHeap) will refer to the underlying range or +T[])) or a random-access container type (usually `Array!T`). The +documentation of `BinaryHeap` will refer to the underlying range or container as the $(I store) of the heap. The binary heap induces structure over the underlying store such that -accessing the largest element (by using the $(D front) property) is a +accessing the largest element (by using the `front` property) is a $(BIGOH 1) operation and extracting it (by using the $(D removeFront()) method) is done fast in $(BIGOH log n) time. -If $(D less) is the less-than operator, which is the default option, -then $(D BinaryHeap) defines a so-called max-heap that optimizes +If `less` is the less-than operator, which is the default option, +then `BinaryHeap` defines a so-called max-heap that optimizes extraction of the $(I largest) elements. To define a min-heap, instantiate BinaryHeap with $(D "a > b") as its predicate. -Simply extracting elements from a $(D BinaryHeap) container is -tantamount to lazily fetching elements of $(D Store) in descending -order. Extracting elements from the $(D BinaryHeap) to completion +Simply extracting elements from a `BinaryHeap` container is +tantamount to lazily fetching elements of `Store` in descending +order. Extracting elements from the `BinaryHeap` to completion leaves the underlying store sorted in ascending order but, again, yields elements in descending order. -If $(D Store) is a range, the $(D BinaryHeap) cannot grow beyond the -size of that range. If $(D Store) is a container that supports $(D -insertBack), the $(D BinaryHeap) may grow by adding elements to the +If `Store` is a range, the `BinaryHeap` cannot grow beyond the +size of that range. If `Store` is a container that supports $(D +insertBack), the `BinaryHeap` may grow by adding elements to the container. */ struct BinaryHeap(Store, alias less = "a < b") @@ -164,12 +164,12 @@ if (isRandomAccessRange!(Store) || isRandomAccessRange!(typeof(Store.init[]))) public: /** - Converts the store $(D s) into a heap. If $(D initialSize) is - specified, only the first $(D initialSize) elements in $(D s) + Converts the store `s` into a heap. If `initialSize` is + specified, only the first `initialSize` elements in `s` are transformed into a heap, after which the heap can grow up - to $(D r.length) (if $(D Store) is a range) or indefinitely (if - $(D Store) is a container with $(D insertBack)). Performs - $(BIGOH min(r.length, initialSize)) evaluations of $(D less). + to `r.length` (if `Store` is a range) or indefinitely (if + `Store` is a container with `insertBack`). Performs + $(BIGOH min(r.length, initialSize)) evaluations of `less`. */ this(Store s, size_t initialSize = size_t.max) { @@ -177,7 +177,7 @@ public: } /** -Takes ownership of a store. After this, manipulating $(D s) may make +Takes ownership of a store. After this, manipulating `s` may make the heap work incorrectly. */ void acquire(Store s, size_t initialSize = size_t.max) @@ -207,8 +207,8 @@ heap. } /** -Clears the heap. Returns the portion of the store from $(D 0) up to -$(D length), which satisfies the $(LUCKY heap property). +Clears the heap. Returns the portion of the store from `0` up to +`length`, which satisfies the $(LUCKY heap property). */ auto release() { @@ -223,7 +223,7 @@ $(D length), which satisfies the $(LUCKY heap property). } /** -Returns $(D true) if the heap is _empty, $(D false) otherwise. +Returns `true` if the heap is _empty, `false` otherwise. */ @property bool empty() { @@ -232,7 +232,7 @@ Returns $(D true) if the heap is _empty, $(D false) otherwise. /** Returns a duplicate of the heap. The underlying store must also -support a $(D dup) method. +support a `dup` method. */ @property BinaryHeap dup() { @@ -270,7 +270,7 @@ underlying store (if the store is a container). /** Returns a copy of the _front of the heap, which is the largest element -according to $(D less). +according to `less`. */ @property ElementType!Store front() { @@ -287,7 +287,7 @@ Clears the heap by detaching it from the underlying store. } /** -Inserts $(D value) into the store. If the underlying store is a range +Inserts `value` into the store. If the underlying store is a range and $(D length == capacity), throws an exception. */ size_t insert(ElementType!Store value) @@ -351,7 +351,7 @@ Removes the largest element from the heap. /** Removes the largest element from the heap and returns a copy of it. The element still resides in the heap's store. For performance -reasons you may want to use $(D removeFront) with heaps of objects +reasons you may want to use `removeFront` with heaps of objects that are expensive to copy. */ ElementType!Store removeAny() @@ -361,7 +361,7 @@ that are expensive to copy. } /** -Replaces the largest element in the store with $(D value). +Replaces the largest element in the store with `value`. */ void replaceFront(ElementType!Store value) { @@ -373,11 +373,11 @@ Replaces the largest element in the store with $(D value). } /** -If the heap has room to grow, inserts $(D value) into the store and -returns $(D true). Otherwise, if $(D less(value, front)), calls $(D -replaceFront(value)) and returns again $(D true). Otherwise, leaves -the heap unaffected and returns $(D false). This method is useful in -scenarios where the smallest $(D k) elements of a set of candidates +If the heap has room to grow, inserts `value` into the store and +returns `true`. Otherwise, if $(D less(value, front)), calls $(D +replaceFront(value)) and returns again `true`. Otherwise, leaves +the heap unaffected and returns `false`. This method is useful in +scenarios where the smallest `k` elements of a set of candidates must be collected. */ bool conditionalInsert(ElementType!Store value) @@ -410,7 +410,7 @@ unittest assert(equal(a, [ 16, 14, 10, 8, 7, 9, 3, 2, 4, 1 ])); } -/// $(D BinaryHeap) implements the standard input range interface, allowing +/// `BinaryHeap` implements the standard input range interface, allowing /// lazy iteration of the underlying range in descending order. unittest { @@ -422,8 +422,8 @@ unittest } /** -Convenience function that returns a $(D BinaryHeap!Store) object -initialized with $(D s) and $(D initialSize). +Convenience function that returns a `BinaryHeap!Store` object +initialized with `s` and `initialSize`. */ BinaryHeap!(Store, less) heapify(alias less = "a < b", Store)(Store s, size_t initialSize = size_t.max) diff --git a/std/container/dlist.d b/std/container/dlist.d index 2c5e2e5e07d..f600d2a1d2b 100644 --- a/std/container/dlist.d +++ b/std/container/dlist.d @@ -135,7 +135,7 @@ nothrow @safe pure: /** Implements a doubly-linked list. -$(D DList) uses reference semantics. +`DList` uses reference semantics. */ struct DList(T) { @@ -207,8 +207,8 @@ Constructor taking an input range /** Comparison for equality. -Complexity: $(BIGOH min(n, n1)) where $(D n1) is the number of -elements in $(D rhs). +Complexity: $(BIGOH min(n, n1)) where `n1` is the number of +elements in `rhs`. */ bool opEquals()(ref const DList rhs) const if (is(typeof(front == front))) @@ -271,7 +271,7 @@ elements in $(D rhs). } /** -Property returning $(D true) if and only if the container has no +Property returning `true` if and only if the container has no elements. Complexity: $(BIGOH 1) @@ -282,9 +282,9 @@ Complexity: $(BIGOH 1) } /** -Removes all contents from the $(D DList). +Removes all contents from the `DList`. -Postcondition: $(D empty) +Postcondition: `empty` Complexity: $(BIGOH 1) */ @@ -320,7 +320,7 @@ Complexity: $(BIGOH 1) } /** -Forward to $(D opSlice().front). +Forward to `opSlice().front`. Complexity: $(BIGOH 1) */ @@ -331,7 +331,7 @@ Complexity: $(BIGOH 1) } /** -Forward to $(D opSlice().back). +Forward to `opSlice().back`. Complexity: $(BIGOH 1) */ @@ -346,8 +346,8 @@ Complexity: $(BIGOH 1) /+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/ /** -Returns a new $(D DList) that's the concatenation of $(D this) and its -argument $(D rhs). +Returns a new `DList` that's the concatenation of `this` and its +argument `rhs`. */ DList opBinary(string op, Stuff)(Stuff rhs) if (op == "~" && is(typeof(insertBack(rhs)))) @@ -358,8 +358,8 @@ argument $(D rhs). } /** -Returns a new $(D DList) that's the concatenation of the argument $(D lhs) -and $(D this). +Returns a new `DList` that's the concatenation of the argument `lhs` +and `this`. */ DList opBinaryRight(string op, Stuff)(Stuff lhs) if (op == "~" && is(typeof(insertFront(lhs)))) @@ -370,7 +370,7 @@ and $(D this). } /** -Appends the contents of the argument $(D rhs) into $(D this). +Appends the contents of the argument `rhs` into `this`. */ DList opOpAssign(string op, Stuff)(Stuff rhs) if (op == "~" && is(typeof(insertBack(rhs)))) @@ -392,8 +392,8 @@ Appends the contents of the argument $(D rhs) into $(D this). /+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +/ /** -Inserts $(D stuff) to the front/back of the container. $(D stuff) can be a -value convertible to $(D T) or a range of objects convertible to $(D +Inserts `stuff` to the front/back of the container. `stuff` can be a +value convertible to `T` or a range of objects convertible to $(D T). The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. @@ -427,18 +427,18 @@ Complexity: $(BIGOH log(n)) alias stableInsertBack = insertBack; /** -Inserts $(D stuff) after range $(D r), which must be a non-empty range +Inserts `stuff` after range `r`, which must be a non-empty range previously extracted from this container. -$(D stuff) can be a value convertible to $(D T) or a range of objects -convertible to $(D T). The stable version behaves the same, but +`stuff` can be a value convertible to `T` or a range of objects +convertible to `T`. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: The number of values inserted. -Complexity: $(BIGOH k + m), where $(D k) is the number of elements in -$(D r) and $(D m) is the length of $(D stuff). +Complexity: $(BIGOH k + m), where `k` is the number of elements in +`r` and `m` is the length of `stuff`. */ size_t insertBefore(Stuff)(Range r, Stuff stuff) { @@ -478,7 +478,7 @@ Picks one value in an unspecified position in the container, removes it from the container, and returns it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. -Precondition: $(D !empty) +Precondition: `!empty` Returns: The element removed. @@ -501,7 +501,7 @@ Removes the value at the front/back of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. -Precondition: $(D !empty) +Precondition: `!empty` Complexity: $(BIGOH 1). */ @@ -527,9 +527,9 @@ Complexity: $(BIGOH 1). alias stableRemoveBack = removeBack; /** -Removes $(D howMany) values at the front or back of the +Removes `howMany` values at the front or back of the container. Unlike the unparameterized versions above, these functions -do not throw if they could not remove $(D howMany) elements. Instead, +do not throw if they could not remove `howMany` elements. Instead, if $(D howMany > n), all elements are removed. The returned value is the effective number of elements removed. The stable version behaves the same, but guarantees that ranges iterating over the container are @@ -575,11 +575,11 @@ Complexity: $(BIGOH howMany). alias stableRemoveBack = removeBack; /** -Removes all elements belonging to $(D r), which must be a range +Removes all elements belonging to `r`, which must be a range obtained originally from this container. Returns: A range spanning the remaining elements in the container that -initially were right after $(D r). +initially were right after `r`. Complexity: $(BIGOH 1) */ @@ -606,8 +606,8 @@ Complexity: $(BIGOH 1) } /** -$(D linearRemove) functions as $(D remove), but also accepts ranges that are -result the of a $(D take) operation. This is a convenient way to remove a +`linearRemove` functions as `remove`, but also accepts ranges that are +result the of a `take` operation. This is a convenient way to remove a fixed amount of elements from the range. Complexity: $(BIGOH r.walkLength) diff --git a/std/container/package.d b/std/container/package.d index 8cf7445dfd3..e1d9122f94f 100644 --- a/std/container/package.d +++ b/std/container/package.d @@ -78,8 +78,8 @@ assert(array2.empty); It is therefore recommended to always construct containers using $(XREF container_util, make). This is in fact necessary if you want to put containers into another container. -Thus to construct an $(D Array) of (e.g) ten other empty $(D Arrays), use -the following that calls $(D make) ten times. +Thus to construct an `Array` of (e.g) ten other empty `Arrays`, use +the following that calls `make` ten times. --- import std.range, std.container, std.algorithm; @@ -96,7 +96,7 @@ This module consists of the following submodules: $(UL $(LI The $(LINK2 std_container_array.html, std._container.array) module provides - an $(D Array) type with deterministic control of memory, not reliant on + an `Array` type with deterministic control of memory, not reliant on the GC unlike the built-in arrays. ) $(LI @@ -125,18 +125,18 @@ $(UL A_containers_primary_range: While some _container offer direct access to its elements e.g. via -$(D opIndex), $(D c.front()) or $(D c.back()), you'll in generall access -and modify _container's contents using its primary $(LINK2 std_range_package.html, range) type, which is aliased as $(D c.Range), -e.g. the primary range type of $(D Array!int) is $(D Array!int.Range). +`opIndex`, `c.front()` or `c.back()`, you'll in generall access +and modify _container's contents using its primary $(LINK2 std_range_package.html, range) type, which is aliased as `c.Range`, +e.g. the primary range type of `Array!int` is `Array!int.Range`. If the documentation of a member function of a container takes a -a parameter of type $(D Range), then it refers to the primary range type of +a parameter of type `Range`, then it refers to the primary range type of this container. And you'll have to pass a range obtained from the same container you call the member function on. If you can pass any type of $(LINK2 std_range_package.html, range) to a member function, the documention usually refers to this (templated) -parameter type as $(D Stuff). +parameter type as `Stuff`. Container_primitives: @@ -145,109 +145,109 @@ common set of primitives (see table below). These primitives each guarantee a specific worst case complexity and thus allow generic code to be written independently of the container implementation. -For example the primitives $(D c.remove(r)) and $(D c.linearRemove(r)) both -remove the sequence of elements in range $(D r) from the container $(D c). -The primitive $(D c.remove(r)) guarantees $(BIGOH 1) complexity and -$(D c.linearRemove(r)) relaxes this guarantee to $(BIGOH n) (where $(D n) -is the length of the container $(D c)). +For example the primitives `c.remove(r)` and `c.linearRemove(r)` both +remove the sequence of elements in range `r` from the container `c`. +The primitive `c.remove(r)` guarantees $(BIGOH 1) complexity and +`c.linearRemove(r)` relaxes this guarantee to $(BIGOH n) (where `n` +is the length of the container `c`). Since a sequence of elements can be removed from a $(LINK2 std_container_dlist.html, doubly linked list) -in constant time $(D DList) provides the primitive $(D c.remove(r)) -as well as $(D c.linearRemove(r)). On the other hand a -$(LINK2 std_container_array.html, Array) only offers $(D c.linearRemove(r)). +in constant time `DList` provides the primitive `c.remove(r)` +as well as `c.linearRemove(r)`. On the other hand a +$(LINK2 std_container_array.html, Array) only offers `c.linearRemove(r)`. The following table describes the common set of primitives that containers implement. A _container need not implement all primitives, but if a primitive is implemented, it must support the syntax described in the $(B syntax) column with the semantics described in the $(B description) column, and it must not have a worst-case complexity worse than denoted in big-O notation in -the $(BIGOH ·) column. Below, $(D C) means a _container type, $(D c) is +the $(BIGOH ·) column. Below, `C` means a _container type, `c` is a value of _container type, $(D n$(SUBSCRIPT x)) represents the effective length of -value $(D x), which could be a single element (in which case $(D n$(SUBSCRIPT x)) is -$(D 1)), a _container, or a range. +value `x`, which could be a single element (in which case $(D n$(SUBSCRIPT x)) is +`1`), a _container, or a range. $(BOOKTABLE Container primitives, $(TR $(TH Syntax) $(TH $(BIGOH ·)) $(TH Description)) -$(TR $(TDNW $(D C(x))) $(TDNW $(D n$(SUBSCRIPT x))) $(TD Creates a -_container of type $(D C) from either another _container or a range.)) +$(TR $(TDNW `C(x)`) $(TDNW $(D n$(SUBSCRIPT x))) $(TD Creates a +_container of type `C` from either another _container or a range.)) -$(TR $(TDNW $(D c.dup)) $(TDNW $(D n$(SUBSCRIPT c))) $(TD Returns a +$(TR $(TDNW `c.dup`) $(TDNW $(D n$(SUBSCRIPT c))) $(TD Returns a duplicate of the _container.)) $(TR $(TDNW $(D c ~ x)) $(TDNW $(D n$(SUBSCRIPT c) + n$(SUBSCRIPT x))) $(TD -Returns the concatenation of $(D c) and $(D r). $(D x) may be a single +Returns the concatenation of `c` and `r`. `x` may be a single element or an input range.)) $(TR $(TDNW $(D x ~ c)) $(TDNW $(D n$(SUBSCRIPT c) + n$(SUBSCRIPT x))) $(TD -Returns the concatenation of $(D x) and $(D c). $(D x) may be a +Returns the concatenation of `x` and `c`. `x` may be a single element or an input range type.)) $(LEADINGROW Iteration) -$(TR $(TD $(D c.Range)) $(TD) $(TD The primary range +$(TR $(TD `c.Range`) $(TD) $(TD The primary range type associated with the _container.)) -$(TR $(TD $(D c[])) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns a range +$(TR $(TD `c[]`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns a range iterating over the entire _container, in a _container-defined order.)) $(TR $(TDNW $(D c[a .. b])) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Fetches a -portion of the _container from key $(D a) to key $(D b).)) +portion of the _container from key `a` to key `b`.)) $(LEADINGROW Capacity) -$(TR $(TD $(D c.empty)) $(TD $(D 1)) $(TD Returns $(D true) if the -_container has no elements, $(D false) otherwise.)) +$(TR $(TD `c.empty`) $(TD `1`) $(TD Returns `true` if the +_container has no elements, `false` otherwise.)) -$(TR $(TD $(D c.length)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the +$(TR $(TD `c.length`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the number of elements in the _container.)) $(TR $(TDNW $(D c.length = n)) $(TDNW $(D n$(SUBSCRIPT c) + n)) $(TD Forces -the number of elements in the _container to $(D n). If the _container +the number of elements in the _container to `n`. If the _container ends up growing, the added elements are initialized in a -_container-dependent manner (usually with $(D T.init)).)) +_container-dependent manner (usually with `T.init`).)) -$(TR $(TD $(D c.capacity)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the +$(TR $(TD `c.capacity`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the maximum number of elements that can be stored in the _container without triggering a reallocation.)) -$(TR $(TD $(D c.reserve(x))) $(TD $(D n$(SUBSCRIPT c))) $(TD Forces $(D -capacity) to at least $(D x) without reducing it.)) +$(TR $(TD `c.reserve(x)`) $(TD $(D n$(SUBSCRIPT c))) $(TD Forces $(D +capacity) to at least `x` without reducing it.)) $(LEADINGROW Access) -$(TR $(TDNW $(D c.front)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the +$(TR $(TDNW `c.front`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the first element of the _container, in a _container-defined order.)) -$(TR $(TDNW $(D c.moveFront)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD +$(TR $(TDNW `c.moveFront`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Destructively reads and returns the first element of the _container. The slot is not removed from the _container; it is left -initialized with $(D T.init). This routine need not be defined if $(D -front) returns a $(D ref).)) +initialized with `T.init`. This routine need not be defined if $(D +front) returns a `ref`.)) $(TR $(TDNW $(D c.front = v)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Assigns -$(D v) to the first element of the _container.)) +`v` to the first element of the _container.)) -$(TR $(TDNW $(D c.back)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the +$(TR $(TDNW `c.back`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Returns the last element of the _container, in a _container-defined order.)) -$(TR $(TDNW $(D c.moveBack)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD +$(TR $(TDNW `c.moveBack`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Destructively reads and returns the last element of the container. The slot is not removed from the _container; it is left -initialized with $(D T.init). This routine need not be defined if $(D -front) returns a $(D ref).)) +initialized with `T.init`. This routine need not be defined if $(D +front) returns a `ref`.)) $(TR $(TDNW $(D c.back = v)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Assigns -$(D v) to the last element of the _container.)) +`v` to the last element of the _container.)) -$(TR $(TDNW $(D c[x])) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Provides +$(TR $(TDNW `c[x]`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD Provides indexed access into the _container. The index type is _container-defined. A container may define several index types (and consequently overloaded indexing).)) -$(TR $(TDNW $(D c.moveAt(x))) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD -Destructively reads and returns the value at position $(D x). The slot +$(TR $(TDNW `c.moveAt(x)`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD +Destructively reads and returns the value at position `x`. The slot is not removed from the _container; it is left initialized with $(D T.init).)) @@ -261,94 +261,94 @@ _container.)) $(LEADINGROW Operations) $(TR $(TDNW $(D e in c)) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD -Returns nonzero if e is found in $(D c).)) +Returns nonzero if e is found in `c`.)) -$(TR $(TDNW $(D c.lowerBound(v))) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD -Returns a range of all elements strictly less than $(D v).)) +$(TR $(TDNW `c.lowerBound(v)`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD +Returns a range of all elements strictly less than `v`.)) -$(TR $(TDNW $(D c.upperBound(v))) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD -Returns a range of all elements strictly greater than $(D v).)) +$(TR $(TDNW `c.upperBound(v)`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD +Returns a range of all elements strictly greater than `v`.)) -$(TR $(TDNW $(D c.equalRange(v))) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD -Returns a range of all elements in $(D c) that are equal to $(D v).)) +$(TR $(TDNW `c.equalRange(v)`) $(TDNW $(D log n$(SUBSCRIPT c))) $(TD +Returns a range of all elements in `c` that are equal to `v`.)) $(LEADINGROW Modifiers) $(TR $(TDNW $(D c ~= x)) $(TDNW $(D n$(SUBSCRIPT c) + n$(SUBSCRIPT x))) -$(TD Appends $(D x) to $(D c). $(D x) may be a single element or an +$(TD Appends `x` to `c`. `x` may be a single element or an input range type.)) -$(TR $(TDNW $(D c.clear())) $(TDNW $(D n$(SUBSCRIPT c))) $(TD Removes all -elements in $(D c).)) +$(TR $(TDNW `c.clear()`) $(TDNW $(D n$(SUBSCRIPT c))) $(TD Removes all +elements in `c`.)) -$(TR $(TDNW $(D c.insert(x))) $(TDNW $(D n$(SUBSCRIPT x) * log n$(SUBSCRIPT c))) -$(TD Inserts $(D x) in $(D c) at a position (or positions) chosen by $(D c).)) +$(TR $(TDNW `c.insert(x)`) $(TDNW $(D n$(SUBSCRIPT x) * log n$(SUBSCRIPT c))) +$(TD Inserts `x` in `c` at a position (or positions) chosen by `c`.)) -$(TR $(TDNW $(D c.stableInsert(x))) -$(TDNW $(D n$(SUBSCRIPT x) * log n$(SUBSCRIPT c))) $(TD Same as $(D c.insert(x)), +$(TR $(TDNW `c.stableInsert(x)`) +$(TDNW $(D n$(SUBSCRIPT x) * log n$(SUBSCRIPT c))) $(TD Same as `c.insert(x)`, but is guaranteed to not invalidate any ranges.)) -$(TR $(TDNW $(D c.linearInsert(v))) $(TDNW $(D n$(SUBSCRIPT c))) $(TD Same -as $(D c.insert(v)) but relaxes complexity to linear.)) +$(TR $(TDNW `c.linearInsert(v)`) $(TDNW $(D n$(SUBSCRIPT c))) $(TD Same +as `c.insert(v)` but relaxes complexity to linear.)) -$(TR $(TDNW $(D c.stableLinearInsert(v))) $(TDNW $(D n$(SUBSCRIPT c))) -$(TD Same as $(D c.stableInsert(v)) but relaxes complexity to linear.)) +$(TR $(TDNW `c.stableLinearInsert(v)`) $(TDNW $(D n$(SUBSCRIPT c))) +$(TD Same as `c.stableInsert(v)` but relaxes complexity to linear.)) -$(TR $(TDNW $(D c.removeAny())) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Removes some element from $(D c) and returns it.)) +$(TR $(TDNW `c.removeAny()`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Removes some element from `c` and returns it.)) -$(TR $(TDNW $(D c.stableRemoveAny())) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Same as $(D c.removeAny()), but is guaranteed to not invalidate any +$(TR $(TDNW `c.stableRemoveAny()`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Same as `c.removeAny()`, but is guaranteed to not invalidate any iterators.)) -$(TR $(TDNW $(D c.insertFront(v))) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Inserts $(D v) at the front of $(D c).)) +$(TR $(TDNW `c.insertFront(v)`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Inserts `v` at the front of `c`.)) -$(TR $(TDNW $(D c.stableInsertFront(v))) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Same as $(D c.insertFront(v)), but guarantees no ranges will be +$(TR $(TDNW `c.stableInsertFront(v)`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Same as `c.insertFront(v)`, but guarantees no ranges will be invalidated.)) -$(TR $(TDNW $(D c.insertBack(v))) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Inserts $(D v) at the back of $(D c).)) +$(TR $(TDNW `c.insertBack(v)`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Inserts `v` at the back of `c`.)) -$(TR $(TDNW $(D c.stableInsertBack(v))) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Same as $(D c.insertBack(v)), but guarantees no ranges will be +$(TR $(TDNW `c.stableInsertBack(v)`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Same as `c.insertBack(v)`, but guarantees no ranges will be invalidated.)) -$(TR $(TDNW $(D c.removeFront())) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Removes the element at the front of $(D c).)) +$(TR $(TDNW `c.removeFront()`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Removes the element at the front of `c`.)) -$(TR $(TDNW $(D c.stableRemoveFront())) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Same as $(D c.removeFront()), but guarantees no ranges will be +$(TR $(TDNW `c.stableRemoveFront()`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Same as `c.removeFront()`, but guarantees no ranges will be invalidated.)) -$(TR $(TDNW $(D c.removeBack())) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Removes the value at the back of $(D c).)) +$(TR $(TDNW `c.removeBack()`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Removes the value at the back of `c`.)) -$(TR $(TDNW $(D c.stableRemoveBack())) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Same as $(D c.removeBack()), but guarantees no ranges will be +$(TR $(TDNW `c.stableRemoveBack()`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Same as `c.removeBack()`, but guarantees no ranges will be invalidated.)) -$(TR $(TDNW $(D c.remove(r))) $(TDNW $(D n$(SUBSCRIPT r) * log n$(SUBSCRIPT c))) -$(TD Removes range $(D r) from $(D c).)) +$(TR $(TDNW `c.remove(r)`) $(TDNW $(D n$(SUBSCRIPT r) * log n$(SUBSCRIPT c))) +$(TD Removes range `r` from `c`.)) -$(TR $(TDNW $(D c.stableRemove(r))) +$(TR $(TDNW `c.stableRemove(r)`) $(TDNW $(D n$(SUBSCRIPT r) * log n$(SUBSCRIPT c))) -$(TD Same as $(D c.remove(r)), but guarantees iterators are not +$(TD Same as `c.remove(r)`, but guarantees iterators are not invalidated.)) -$(TR $(TDNW $(D c.linearRemove(r))) $(TDNW $(D n$(SUBSCRIPT c))) -$(TD Removes range $(D r) from $(D c).)) +$(TR $(TDNW `c.linearRemove(r)`) $(TDNW $(D n$(SUBSCRIPT c))) +$(TD Removes range `r` from `c`.)) -$(TR $(TDNW $(D c.stableLinearRemove(r))) $(TDNW $(D n$(SUBSCRIPT c))) -$(TD Same as $(D c.linearRemove(r)), but guarantees iterators are not +$(TR $(TDNW `c.stableLinearRemove(r)`) $(TDNW $(D n$(SUBSCRIPT c))) +$(TD Same as `c.linearRemove(r)`, but guarantees iterators are not invalidated.)) -$(TR $(TDNW $(D c.removeKey(k))) $(TDNW $(D log n$(SUBSCRIPT c))) -$(TD Removes an element from $(D c) by using its key $(D k). +$(TR $(TDNW `c.removeKey(k)`) $(TDNW $(D log n$(SUBSCRIPT c))) +$(TD Removes an element from `c` by using its key `k`. The key's type is defined by the _container.)) -$(TR $(TDNW $(D )) $(TDNW $(D )) $(TD )) +$(TR $(TDNW ``) $(TDNW ``) $(TD )) ) @@ -378,10 +378,10 @@ public import std.container.slist; import std.typetuple; -/* The following documentation and type $(D TotalContainer) are +/* The following documentation and type `TotalContainer` are intended for developers only. -$(D TotalContainer) is an unimplemented container that illustrates a +`TotalContainer` is an unimplemented container that illustrates a host of primitives that a container may define. It is to some extent the bottom of the conceptual container hierarchy. A given container most often will choose to only implement a subset of these primitives, @@ -389,7 +389,7 @@ and define its own additional ones. Adhering to the standard primitive names below allows generic code to work independently of containers. Things to remember: any container must be a reference type, whether -implemented as a $(D class) or $(D struct). No primitive below +implemented as a `class` or `struct`. No primitive below requires the container to escape addresses of elements, which means that compliant containers can be defined to use reference counting or other deterministic memory management techniques. @@ -401,32 +401,32 @@ the ones below, lest user code gets confused. Complexity of operations should be interpreted as "at least as good as". If an operation is required to have $(BIGOH n) complexity, it could have anything lower than that, e.g. $(BIGOH log(n)). Unless -specified otherwise, $(D n) inside a $(BIGOH) expression stands for +specified otherwise, `n` inside a $(BIGOH) expression stands for the number of elements in the container. */ struct TotalContainer(T) { /** -If the container has a notion of key-value mapping, $(D KeyType) +If the container has a notion of key-value mapping, `KeyType` defines the type of the key of the container. */ alias KeyType = T; /** If the container has a notion of multikey-value mapping, $(D -KeyTypes[k]), where $(D k) is a zero-based unsigned number, defines -the type of the $(D k)th key of the container. +KeyTypes[k]), where `k` is a zero-based unsigned number, defines +the type of the `k`th key of the container. -A container may define both $(D KeyType) and $(D KeyTypes), e.g. in +A container may define both `KeyType` and `KeyTypes`, e.g. in the case it has the notion of primary/preferred key. */ alias KeyTypes = TypeTuple!T; /** -If the container has a notion of key-value mapping, $(D ValueType) +If the container has a notion of key-value mapping, `ValueType` defines the type of the value of the container. Typically, a map-style -container mapping values of type $(D K) to values of type $(D V) -defines $(D KeyType) to be $(D K) and $(D ValueType) to be $(D V). +container mapping values of type `K` to values of type `V` +defines `KeyType` to be `K` and `ValueType` to be `V`. */ alias ValueType = T; @@ -518,7 +518,7 @@ Generally a container may define several types of ranges. } /** -Property returning $(D true) if and only if the container has no +Property returning `true` if and only if the container has no elements. Complexity: $(BIGOH 1) @@ -561,7 +561,7 @@ Complexity: $(BIGOH log(n)). } /** -Ensures sufficient capacity to accommodate $(D n) elements. +Ensures sufficient capacity to accommodate `n` elements. Postcondition: $(D capacity >= n) @@ -576,7 +576,7 @@ $(BIGOH 1). /** Returns a range that iterates over all elements of the container, in a container-defined order. The container should choose the most -convenient and fast method of iteration for $(D opSlice()). +convenient and fast method of iteration for `opSlice()`. Complexity: $(BIGOH log(n)) */ @@ -597,7 +597,7 @@ Complexity: $(BIGOH log(n)) } /** -Forward to $(D opSlice().front) and $(D opSlice().back), respectively. +Forward to `opSlice().front` and `opSlice().back`, respectively. Complexity: $(BIGOH log(n)) */ @@ -668,7 +668,7 @@ $(D k in container) returns true if the given key is in the container. } /** -Returns a range of all elements containing $(D k) (could be empty or a +Returns a range of all elements containing `k` (could be empty or a singleton range). */ Range equalRange(KeyType k) @@ -677,7 +677,7 @@ singleton range). } /** -Returns a range of all elements with keys less than $(D k) (could be +Returns a range of all elements with keys less than `k` (could be empty or a singleton range). Only defined by containers that store data sorted at all times. */ @@ -687,7 +687,7 @@ data sorted at all times. } /** -Returns a range of all elements with keys larger than $(D k) (could be +Returns a range of all elements with keys larger than `k` (could be empty or a singleton range). Only defined by containers that store data sorted at all times. */ @@ -697,9 +697,9 @@ data sorted at all times. } /** -Returns a new container that's the concatenation of $(D this) and its -argument. $(D opBinaryRight) is only defined if $(D Stuff) does not -define $(D opBinary). +Returns a new container that's the concatenation of `this` and its +argument. `opBinaryRight` is only defined if `Stuff` does not +define `opBinary`. Complexity: $(BIGOH n + m), where m is the number of elements in $(D stuff) @@ -727,7 +727,7 @@ Forwards to $(D insertAfter(this[], stuff)). Removes all contents from the container. The container decides how $(D capacity) is affected. -Postcondition: $(D empty) +Postcondition: `empty` Complexity: $(BIGOH n) */ @@ -737,8 +737,8 @@ Complexity: $(BIGOH n) } /** -Sets the number of elements in the container to $(D newSize). If $(D -newSize) is greater than $(D length), the added elements are added to +Sets the number of elements in the container to `newSize`. If $(D +newSize) is greater than `length`, the added elements are added to unspecified positions in the container and initialized with $(D .init). @@ -752,21 +752,21 @@ Postcondition: $(D _length == newLength) } /** -Inserts $(D stuff) in an unspecified position in the +Inserts `stuff` in an unspecified position in the container. Implementations should choose whichever insertion means is the most advantageous for the container, but document the exact -behavior. $(D stuff) can be a value convertible to the element type of +behavior. `stuff` can be a value convertible to the element type of the container, or a range of values convertible to it. -The $(D stable) version guarantees that ranges iterating over the +The `stable` version guarantees that ranges iterating over the container are never invalidated. Client code that counts on -non-invalidating insertion should use $(D stableInsert). Such code would +non-invalidating insertion should use `stableInsert`. Such code would not compile against containers that don't support it. Returns: The number of elements added. -Complexity: $(BIGOH m * log(n)), where $(D m) is the number of -elements in $(D stuff) +Complexity: $(BIGOH m * log(n)), where `m` is the number of +elements in `stuff` */ size_t insert(Stuff)(Stuff stuff) { @@ -779,7 +779,7 @@ elements in $(D stuff) } /** -Same as $(D insert(stuff)) and $(D stableInsert(stuff)) respectively, +Same as `insert(stuff)` and `stableInsert(stuff)` respectively, but relax the complexity constraint to linear. */ size_t linearInsert(Stuff)(Stuff stuff) @@ -799,7 +799,7 @@ value that's the most advantageous for the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. -Precondition: $(D !empty) +Precondition: `!empty` Returns: The element removed. @@ -816,7 +816,7 @@ Complexity: $(BIGOH log(n)). } /** -Inserts $(D value) to the front or back of the container. $(D stuff) +Inserts `value` to the front or back of the container. `stuff` can be a value convertible to the container's element type or a range of values convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never @@ -853,7 +853,7 @@ the container are never invalidated. The optional parameter $(D howMany) instructs removal of that many elements. If $(D howMany > n), all elements are removed and no exception is thrown. -Precondition: $(D !empty) +Precondition: `!empty` Complexity: $(BIGOH log(n)). */ @@ -878,9 +878,9 @@ Complexity: $(BIGOH log(n)). } /** -Removes $(D howMany) values at the front or back of the +Removes `howMany` values at the front or back of the container. Unlike the unparameterized versions above, these functions -do not throw if they could not remove $(D howMany) elements. Instead, +do not throw if they could not remove `howMany` elements. Instead, if $(D howMany > n), all elements are removed. The returned value is the effective number of elements removed. The stable version behaves the same, but guarantees that ranges iterating over the container are @@ -911,9 +911,9 @@ Complexity: $(BIGOH howMany * log(n)). } /** -Removes all values corresponding to key $(D k). +Removes all values corresponding to key `k`. -Complexity: $(BIGOH m * log(n)), where $(D m) is the number of +Complexity: $(BIGOH m * log(n)), where `m` is the number of elements with the same key. Returns: The number of elements removed. @@ -924,8 +924,8 @@ Returns: The number of elements removed. } /** -Inserts $(D stuff) before, after, or instead range $(D r), which must -be a valid range previously extracted from this container. $(D stuff) +Inserts `stuff` before, after, or instead range `r`, which must +be a valid range previously extracted from this container. `stuff` can be a value convertible to the container's element type or a range of objects convertible to it. The stable version behaves the same, but guarantees that ranges iterating over the container are never @@ -933,7 +933,7 @@ invalidated. Returns: The number of values inserted. -Complexity: $(BIGOH n + m), where $(D m) is the length of $(D stuff) +Complexity: $(BIGOH n + m), where `m` is the length of `stuff` */ size_t insertBefore(Stuff)(Range r, Stuff stuff) { @@ -966,16 +966,16 @@ Complexity: $(BIGOH n + m), where $(D m) is the length of $(D stuff) } /** -Removes all elements belonging to $(D r), which must be a range +Removes all elements belonging to `r`, which must be a range obtained originally from this container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: A range spanning the remaining elements in the container that -initially were right after $(D r). +initially were right after `r`. -Complexity: $(BIGOH m * log(n)), where $(D m) is the number of -elements in $(D r) +Complexity: $(BIGOH m * log(n)), where `m` is the number of +elements in `r` */ Range remove(Range r) { @@ -988,10 +988,10 @@ elements in $(D r) } /** -Same as $(D remove) above, but has complexity relaxed to linear. +Same as `remove` above, but has complexity relaxed to linear. Returns: A range spanning the remaining elements in the container that -initially were right after $(D r). +initially were right after `r`. Complexity: $(BIGOH n) */ diff --git a/std/container/rbtree.d b/std/container/rbtree.d index ce7c2616d1b..b4e169e6c73 100644 --- a/std/container/rbtree.d +++ b/std/container/rbtree.d @@ -609,15 +609,15 @@ struct RBNode(V) * * To use a different comparison than $(D "a < b"), pass a different operator string * that can be used by $(XREF functional, binaryFun), or pass in a - * function, delegate, functor, or any type where $(D less(a, b)) results in a $(D bool) + * function, delegate, functor, or any type where $(D less(a, b)) results in a `bool` * value. * * Note that less should produce a strict ordering. That is, for two unequal - * elements $(D a) and $(D b), $(D less(a, b) == !less(b, a)). $(D less(a, a)) should - * always equal $(D false). + * elements `a` and `b`, $(D less(a, b) == !less(b, a)). $(D less(a, a)) should + * always equal `false`. * - * If $(D allowDuplicates) is set to $(D true), then inserting the same element more than - * once continues to add more elements. If it is $(D false), duplicate elements are + * If `allowDuplicates` is set to `true`, then inserting the same element more than + * once continues to add more elements. If it is `false`, duplicate elements are * ignored on insertion. If duplicates are allowed, then new elements are * inserted after all existing duplicate elements. */ @@ -769,7 +769,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) } /** - * The range type for $(D RedBlackTree) + * The range type for `RedBlackTree` */ struct Range { @@ -783,7 +783,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) } /** - * Returns $(D true) if the range is _empty + * Returns `true` if the range is _empty */ @property bool empty() const { @@ -827,7 +827,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) } /** - * Trivial _save implementation, needed for $(D isForwardRange). + * Trivial _save implementation, needed for `isForwardRange`. */ @property Range save() { @@ -900,7 +900,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) } /** - * Check if any elements exist in the container. Returns $(D false) if at least + * Check if any elements exist in the container. Returns `false` if at least * one element exists. */ @property bool empty() @@ -973,7 +973,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) } /++ - $(D in) operator. Check to see if the given element exists in the + `in` operator. Check to see if the given element exists in the container. Complexity: $(BIGOH log(n)) @@ -1248,7 +1248,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) } /++ - Removes the given $(D Take!Range) from the container + Removes the given `Take!Range` from the container Returns: A range containing all of the elements that were after the given range. @@ -1303,7 +1303,7 @@ final class RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) /++ Removes elements from the container that are equal to the given values according to the less comparator. One element is removed for each value - given which is in the container. If $(D allowDuplicates) is true, + given which is in the container. If `allowDuplicates` is true, duplicates are removed only if duplicate values are given. Returns: The number of elements removed. @@ -1703,7 +1703,7 @@ pure unittest } /++ - Convenience function for creating a $(D RedBlackTree!E) from a list of + Convenience function for creating a `RedBlackTree!E` from a list of values. +/ auto redBlackTree(E)(E[] elems...) diff --git a/std/container/slist.d b/std/container/slist.d index 819ed82e3fc..09366756dbf 100644 --- a/std/container/slist.d +++ b/std/container/slist.d @@ -24,7 +24,7 @@ public import std.container.util; /** Implements a simple and fast singly-linked list. - $(D SList) uses reference semantics. + `SList` uses reference semantics. */ struct SList(T) { @@ -118,8 +118,8 @@ Constructor taking an input range /** Comparison for equality. -Complexity: $(BIGOH min(n, n1)) where $(D n1) is the number of -elements in $(D rhs). +Complexity: $(BIGOH min(n, n1)) where `n1` is the number of +elements in `rhs`. */ bool opEquals(const SList rhs) const { @@ -190,7 +190,7 @@ Defines the container's primary range, which embodies a forward range. } /** -Property returning $(D true) if and only if the container has no +Property returning `true` if and only if the container has no elements. Complexity: $(BIGOH 1) @@ -226,7 +226,7 @@ Complexity: $(BIGOH 1) } /** -Forward to $(D opSlice().front). +Forward to `opSlice().front`. Complexity: $(BIGOH 1) */ @@ -244,9 +244,9 @@ Complexity: $(BIGOH 1) } /** -Returns a new $(D SList) that's the concatenation of $(D this) and its -argument. $(D opBinaryRight) is only defined if $(D Stuff) does not -define $(D opBinary). +Returns a new `SList` that's the concatenation of `this` and its +argument. `opBinaryRight` is only defined if `Stuff` does not +define `opBinary`. */ SList opBinary(string op, Stuff)(Stuff rhs) if (op == "~" && is(typeof(SList(rhs)))) @@ -272,9 +272,9 @@ define $(D opBinary). } /** -Removes all contents from the $(D SList). +Removes all contents from the `SList`. -Postcondition: $(D empty) +Postcondition: `empty` Complexity: $(BIGOH 1) */ @@ -284,14 +284,14 @@ Complexity: $(BIGOH 1) } /** -Inserts $(D stuff) to the front of the container. $(D stuff) can be a -value convertible to $(D T) or a range of objects convertible to $(D +Inserts `stuff` to the front of the container. `stuff` can be a +value convertible to `T` or a range of objects convertible to $(D T). The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: The number of elements inserted -Complexity: $(BIGOH m), where $(D m) is the length of $(D stuff) +Complexity: $(BIGOH m), where `m` is the length of `stuff` */ size_t insertFront(Stuff)(Stuff stuff) if (isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, T)) @@ -337,7 +337,7 @@ Picks one value in an unspecified position in the container, removes it from the container, and returns it. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. -Precondition: $(D !empty) +Precondition: `!empty` Returns: The element removed. @@ -360,7 +360,7 @@ Removes the value at the front of the container. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. -Precondition: $(D !empty) +Precondition: `!empty` Complexity: $(BIGOH 1). */ @@ -374,9 +374,9 @@ Complexity: $(BIGOH 1). alias stableRemoveFront = removeFront; /** -Removes $(D howMany) values at the front or back of the +Removes `howMany` values at the front or back of the container. Unlike the unparameterized versions above, these functions -do not throw if they could not remove $(D howMany) elements. Instead, +do not throw if they could not remove `howMany` elements. Instead, if $(D howMany > n), all elements are removed. The returned value is the effective number of elements removed. The stable version behaves the same, but guarantees that ranges iterating over the container are @@ -401,22 +401,22 @@ Complexity: $(BIGOH howMany * log(n)). alias stableRemoveFront = removeFront; /** -Inserts $(D stuff) after range $(D r), which must be a range +Inserts `stuff` after range `r`, which must be a range previously extracted from this container. Given that all ranges for a list end at the end of the list, this function essentially appends to -the list and uses $(D r) as a potentially fast way to reach the last -node in the list. Ideally $(D r) is positioned near or at the last +the list and uses `r` as a potentially fast way to reach the last +node in the list. Ideally `r` is positioned near or at the last element of the list. -$(D stuff) can be a value convertible to $(D T) or a range of objects -convertible to $(D T). The stable version behaves the same, but +`stuff` can be a value convertible to `T` or a range of objects +convertible to `T`. The stable version behaves the same, but guarantees that ranges iterating over the container are never invalidated. Returns: The number of values inserted. -Complexity: $(BIGOH k + m), where $(D k) is the number of elements in -$(D r) and $(D m) is the length of $(D stuff). +Complexity: $(BIGOH k + m), where `k` is the number of elements in +`r` and `m` is the length of `stuff`. Examples: -------------------- @@ -444,18 +444,18 @@ assert(std.algorithm.equal(sl[], ["a", "b", "c", "d", "e"])); } /** -Similar to $(D insertAfter) above, but accepts a range bounded in +Similar to `insertAfter` above, but accepts a range bounded in count. This is important for ensuring fast insertions in the middle of -the list. For fast insertions after a specified position $(D r), use +the list. For fast insertions after a specified position `r`, use $(D insertAfter(take(r, 1), stuff)). The complexity of that operation -only depends on the number of elements in $(D stuff). +only depends on the number of elements in `stuff`. Precondition: $(D r.original.empty || r.maxLength > 0) Returns: The number of values inserted. -Complexity: $(BIGOH k + m), where $(D k) is the number of elements in -$(D r) and $(D m) is the length of $(D stuff). +Complexity: $(BIGOH k + m), where `k` is the number of elements in +`r` and `m` is the length of `stuff`. */ size_t insertAfter(Stuff)(Take!Range r, Stuff stuff) { @@ -505,7 +505,7 @@ Complexity: $(BIGOH n) } /** -Removes a $(D Take!Range) from the list in linear time. +Removes a `Take!Range` from the list in linear time. Returns: A range comprehending the elements after the removed range. diff --git a/std/conv.d b/std/conv.d index 28a8874ba14..1fc95b8916a 100644 --- a/std/conv.d +++ b/std/conv.d @@ -277,7 +277,7 @@ might fail the range check. /** Entry point that dispatches to the appropriate conversion primitive. Client code normally calls $(D _to!TargetType(value)) - (and not some variant of $(D toImpl)). + (and not some variant of `toImpl`). */ template to(T) { @@ -528,7 +528,7 @@ T toImpl(T, S)(S value) /** When target type supports 'converting construction', it is used. -$(UL $(LI If target type is struct, $(D T(value)) is used.) +$(UL $(LI If target type is struct, `T(value)` is used.) $(LI If target type is class, $(D new T(value)) is used.)) */ T toImpl(T, S)(S value) @@ -789,21 +789,21 @@ T toImpl(T, S)(S value) Stringize conversion from all types is supported. $(UL $(LI String _to string conversion works for any two string types having - ($(D char), $(D wchar), $(D dchar)) character widths and any - combination of qualifiers (mutable, $(D const), or $(D immutable)).) + (`char`, `wchar`, `dchar`) character widths and any + combination of qualifiers (mutable, `const`, or `immutable`).) $(LI Converts array (other than strings) to string. - Each element is converted by calling $(D to!T).) + Each element is converted by calling `to!T`.) $(LI Associative array to string conversion. - Each element is printed by calling $(D to!T).) - $(LI Object to string conversion calls $(D toString) against the object or - returns $(D "null") if the object is null.) - $(LI Struct to string conversion calls $(D toString) against the struct if + Each element is printed by calling `to!T`.) + $(LI Object to string conversion calls `toString` against the object or + returns `"null"` if the object is null.) + $(LI Struct to string conversion calls `toString` against the struct if it is defined.) - $(LI For structs that do not define $(D toString), the conversion to string + $(LI For structs that do not define `toString`, the conversion to string produces the list of fields.) $(LI Enumerated types are converted to strings as their symbolic names.) - $(LI Boolean values are printed as $(D "true") or $(D "false").) - $(LI $(D char), $(D wchar), $(D dchar) to a string type.) + $(LI Boolean values are printed as `"true"` or `"false"`.) + $(LI `char`, `wchar`, `dchar` to a string type.) $(LI Unsigned or signed integers to strings. $(DL $(DT [special case]) $(DD Convert integral value to string in $(D_PARAM radix) radix. @@ -813,8 +813,8 @@ $(UL and their case is determined by the $(D_PARAM letterCase) parameter.))) $(LI All floating point types to all string types.) $(LI Pointer to string conversions prints the pointer as a $(D size_t) value. - If pointer is $(D char*), treat it as C-style strings. - In that case, this function is $(D @system).)) + If pointer is `char*`, treat it as C-style strings. + In that case, this function is `@system`.)) */ T toImpl(T, S)(S value) if (!(isImplicitlyConvertible!(S, T) && @@ -914,7 +914,7 @@ T toImpl(T, S)(S value) } /* - Check whether type $(D T) can be used in a switch statement. + Check whether type `T` can be used in a switch statement. This is useful for compile-time generation of switch case statements. */ private template isSwitchable(E) @@ -1390,7 +1390,7 @@ unittest /** Array-to-array conversion (except when target is a string type) -converts each element in turn by using $(D to). +converts each element in turn by using `to`. */ T toImpl(T, S)(S value) if (!isImplicitlyConvertible!(S, T) && @@ -3155,8 +3155,8 @@ package void skipWS(R)(ref R r) /** * Parses an array from a string given the left bracket (default $(D - * '[')), right bracket (default $(D ']')), and element separator (by - * default $(D ',')). + * '[')), right bracket (default `']'`), and element separator (by + * default `','`). */ Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar comma = ',') if (isExactSomeString!Source && @@ -3336,8 +3336,8 @@ Lfewerr: /** * Parses an associative array from a string given the left bracket (default $(D - * '[')), right bracket (default $(D ']')), key-value separator (default $(D - * ':')), and element seprator (by default $(D ',')). + * '[')), right bracket (default `']'`), key-value separator (default $(D + * ':')), and element seprator (by default `','`). */ Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar keyval = ':', dchar comma = ',') if (isExactSomeString!Source && @@ -3633,18 +3633,18 @@ unittest /*************************************************************** -The $(D octal) facility is intended as an experimental facility to -replace _octal literals starting with $(D '0'), which many find -confusing. Using $(D octal!177) or $(D octal!"177") instead of $(D +The `octal` facility is intended as an experimental facility to +replace _octal literals starting with `'0'`, which many find +confusing. Using `octal!177` or `octal!"177"` instead of $(D 0177) as an _octal literal makes code clearer and the intent more visible. If use of this facility becomes predominant, a future version of the language may deem old-style _octal literals deprecated. The rules for strings are the usual for literals: If it can fit in an -$(D int), it is an $(D int). Otherwise, it is a $(D long). But, if the -user specifically asks for a $(D long) with the $(D L) suffix, always -give the $(D long). Give an unsigned iff it is asked for with the $(D -U) or $(D u) suffix. _Octals created from integers preserve the type +`int`, it is an `int`. Otherwise, it is a `long`. But, if the +user specifically asks for a `long` with the `L` suffix, always +give the `long`. Give an unsigned iff it is asked for with the $(D +U) or `u` suffix. _Octals created from integers preserve the type of the passed-in integral. */ @property int octal(string num)() @@ -4088,12 +4088,12 @@ ref T emplaceOpCaller(T, Args...)(ref T chunk, auto ref Args args) // emplace /** -Given a pointer $(D chunk) to uninitialized memory (but already typed -as $(D T)), constructs an object of non-$(D class) type $(D T) at that +Given a pointer `chunk` to uninitialized memory (but already typed +as `T`), constructs an object of non-`class` type `T` at that address. Returns: A pointer to the newly constructed object (which is the same -as $(D chunk)). +as `chunk`). */ T* emplace(T)(T* chunk) @safe pure nothrow { @@ -4102,15 +4102,15 @@ T* emplace(T)(T* chunk) @safe pure nothrow } /** -Given a pointer $(D chunk) to uninitialized memory (but already typed -as a non-class type $(D T)), constructs an object of type $(D T) at -that address from arguments $(D args). +Given a pointer `chunk` to uninitialized memory (but already typed +as a non-class type `T`), constructs an object of type `T` at +that address from arguments `args`. -This function can be $(D @trusted) if the corresponding constructor of -$(D T) is $(D @safe). +This function can be `@trusted` if the corresponding constructor of +`T` is `@safe`. Returns: A pointer to the newly constructed object (which is the same -as $(D chunk)). +as `chunk`). */ T* emplace(T, Args...)(T* chunk, auto ref Args args) if (!is(T == struct) && Args.length == 1) @@ -4960,15 +4960,15 @@ private void testEmplaceChunk(void[] chunk, size_t typeSize, size_t typeAlignmen } /** -Given a raw memory area $(D chunk), constructs an object of $(D class) -type $(D T) at that address. The constructor is passed the arguments -$(D Args). The $(D chunk) must be as least as large as $(D T) needs -and should have an alignment multiple of $(D T)'s alignment. (The size -of a $(D class) instance is obtained by using $(D +Given a raw memory area `chunk`, constructs an object of `class` +type `T` at that address. The constructor is passed the arguments +`Args`. The `chunk` must be as least as large as `T` needs +and should have an alignment multiple of `T`'s alignment. (The size +of a `class` instance is obtained by using $(D __traits(classInstanceSize, T))). -This function can be $(D @trusted) if the corresponding constructor of -$(D T) is $(D @safe). +This function can be `@trusted` if the corresponding constructor of +`T` is `@safe`. Returns: A pointer to the newly constructed object. */ @@ -5007,14 +5007,14 @@ unittest } /** -Given a raw memory area $(D chunk), constructs an object of non-$(D -class) type $(D T) at that address. The constructor is passed the -arguments $(D args), if any. The $(D chunk) must be as least as large -as $(D T) needs and should have an alignment multiple of $(D T)'s +Given a raw memory area `chunk`, constructs an object of non-$(D +class) type `T` at that address. The constructor is passed the +arguments `args`, if any. The `chunk` must be as least as large +as `T` needs and should have an alignment multiple of `T`'s alignment. -This function can be $(D @trusted) if the corresponding constructor of -$(D T) is $(D @safe). +This function can be `@trusted` if the corresponding constructor of +`T` is `@safe`. Returns: A pointer to the newly constructed object. */ @@ -5116,10 +5116,10 @@ unittest /** - Returns the corresponding _unsigned value for $(D x) (e.g. if $(D x) has type - $(D int), it returns $(D cast(uint) x)). The advantage compared to the cast - is that you do not need to rewrite the cast if $(D x) later changes type - (e.g from $(D int) to $(D long)). + Returns the corresponding _unsigned value for `x` (e.g. if `x` has type + `int`, it returns $(D cast(uint) x)). The advantage compared to the cast + is that you do not need to rewrite the cast if `x` later changes type + (e.g from `int` to `long`). Note that the result is always mutable even if the original type was const or immutable. In order to retain the constness, use $(XREF traits, Unsigned). @@ -5190,10 +5190,10 @@ unittest /** - Returns the corresponding _signed value for $(D x) (e.g. if $(D x) has type - $(D uint), it returns $(D cast(int) x)). The advantage compared to the cast - is that you do not need to rewrite the cast if $(D x) later changes type - (e.g from $(D uint) to $(D ulong)). + Returns the corresponding _signed value for `x` (e.g. if `x` has type + `uint`, it returns $(D cast(int) x)). The advantage compared to the cast + is that you do not need to rewrite the cast if `x` later changes type + (e.g from `uint` to `ulong`). Note that the result is always mutable even if the original type was const or immutable. In order to retain the constness, use $(XREF traits, Signed). @@ -5265,7 +5265,7 @@ unittest From = The type to cast from. The programmer must ensure it is legal to make this cast. To = The type to cast to - value = The value to cast. It must be of type $(D From), + value = The value to cast. It must be of type `From`, otherwise a compile-time error is emitted. Returns: diff --git a/std/csv.d b/std/csv.d index 37856edfb9f..aa505dbe28e 100644 --- a/std/csv.d +++ b/std/csv.d @@ -2,7 +2,7 @@ /** * Implements functionality to read Comma Separated Values and its variants - * from a input range of $(D dchar). + * from a input range of `dchar`. * * Comma Separated Values provide a simple means to transfer and store * tabular data. It has been common for programs to use their own @@ -42,7 +42,7 @@ * } * ------- * - * When an input contains a header the $(D Contents) can be specified as an + * When an input contains a header the `Contents` can be specified as an * associative array. Passing null to signify that a header is present. * * ------- @@ -250,7 +250,7 @@ enum Malformed * Returns an input range for iterating over records found in $(D * input). * - * The $(D Contents) of the input can be provided if all the records are the + * The `Contents` of the input can be provided if all the records are the * same type such as all integer data: * * ------- @@ -285,7 +285,7 @@ enum Malformed * } * ------- * - * Specifying $(D ErrorLevel) as Malformed.ignore will lift restrictions + * Specifying `ErrorLevel` as Malformed.ignore will lift restrictions * on the format. This example shows that an exception is not thrown when * finding a quote in a field not quoted. * @@ -300,8 +300,8 @@ enum Malformed * Returns: * An input range R as defined by $(XREF range, isInputRange). When $(D * Contents) is a struct, class, or an associative array, the element - * type of R is $(D Contents), otherwise the element type of R is itself - * a range with element type $(D Contents). + * type of R is `Contents`, otherwise the element type of R is itself + * a range with element type `Contents`. * * Throws: * $(LREF CSVException) When a quote is found in an unquoted field, @@ -312,7 +312,7 @@ enum Malformed * $(LREF HeaderMismatchException) when a header is provided but a * matching column is not found or the order did not match that found in * the input. Read the exception documentation for specific details of - * when the exception is thrown for different types of $(D Contents). + * when the exception is thrown for different types of `Contents`. */ auto csvReader(Contents = string,Malformed ErrorLevel = Malformed.throwException, Range, Separator = char)(Range input, Separator delimiter = ',', Separator quote = '"') @@ -326,10 +326,10 @@ auto csvReader(Contents = string,Malformed ErrorLevel = Malformed.throwException } /** - * An optional $(D header) can be provided. The first record will be read in - * as the header. If $(D Contents) is a struct then the header provided is - * expected to correspond to the fields in the struct. When $(D Contents) is - * not a type which can contain the entire record, the $(D header) must be + * An optional `header` can be provided. The first record will be read in + * as the header. If `Contents` is a struct then the header provided is + * expected to correspond to the fields in the struct. When `Contents` is + * not a type which can contain the entire record, the `header` must be * provided in the same order as the input or an exception is thrown. * * Read only column "b": @@ -374,8 +374,8 @@ auto csvReader(Contents = string,Malformed ErrorLevel = Malformed.throwException * Returns: * An input range R as defined by $(XREF range, isInputRange). When $(D * Contents) is a struct, class, or an associative array, the element - * type of R is $(D Contents), otherwise the element type of R is itself - * a range with element type $(D Contents). + * type of R is `Contents`, otherwise the element type of R is itself + * a range with element type `Contents`. * * The returned range provides a header field for accessing the header * from the input in array form. @@ -396,7 +396,7 @@ auto csvReader(Contents = string,Malformed ErrorLevel = Malformed.throwException * $(LREF HeaderMismatchException) when a header is provided but a * matching column is not found or the order did not match that found in * the input. Read the exception documentation for specific details of - * when the exception is thrown for different types of $(D Contents). + * when the exception is thrown for different types of `Contents`. */ auto csvReader(Contents = string, Malformed ErrorLevel = Malformed.throwException, @@ -777,7 +777,7 @@ private pure struct Input(Range, Malformed ErrorLevel) * Range for iterating CSV records. * * This range is returned by the $(LREF csvReader) functions. It can be - * created in a similar manner to allow $(D ErrorLevel) be set to $(LREF + * created in a similar manner to allow `ErrorLevel` be set to $(LREF * Malformed).ignore if best guess processing should take place. */ private struct CsvReader(Contents, Malformed ErrorLevel, Range, Separator, Header) @@ -936,14 +936,14 @@ public: * Part of an input range as defined by $(XREF range, isInputRange). * * Returns: - * If $(D Contents) is a struct, will be filled with record data. + * If `Contents` is a struct, will be filled with record data. * - * If $(D Contents) is a class, will be filled with record data. + * If `Contents` is a class, will be filled with record data. * - * If $(D Contents) is a associative array, will be filled + * If `Contents` is a associative array, will be filled * with record data. * - * If $(D Contents) is non-struct, a $(LREF CsvRecord) will be + * If `Contents` is non-struct, a $(LREF CsvRecord) will be * returned. */ @property auto front() @@ -1111,7 +1111,7 @@ public: /* * This input range is accessible through $(LREF CsvReader) when the - * requested $(D Contents) type is neither a structure or an associative array. + * requested `Contents` type is neither a structure or an associative array. */ private struct CsvRecord(Contents, Malformed ErrorLevel, Range, Separator) if (!is(Contents == class) && !is(Contents == struct)) diff --git a/std/datetime.d b/std/datetime.d index 9e89766d877..d1cbc827a6f 100644 --- a/std/datetime.d +++ b/std/datetime.d @@ -16,7 +16,7 @@ $(LI Various helper functions.) ) - Closely related to std.datetime is $(D core.time), + Closely related to std.datetime is `core.time`, and some of the time types used in std.datetime come from there - such as $(CXREF time, Duration), $(CXREF time, TickDuration), and $(CXREF time, FracSec). @@ -55,10 +55,10 @@ To get the current time, use $(LREF2 .Clock.currTime, Clock.currTime). It will return the current - time as a $(LREF SysTime). To print it, $(D toString) is - sufficient, but if using $(D toISOString), $(D toISOExtString), or - $(D toSimpleString), use the corresponding $(D fromISOString), - $(D fromISOExtString), or $(D fromSimpleString) to create a + time as a $(LREF SysTime). To print it, `toString` is + sufficient, but if using `toISOString`, `toISOExtString`, or + `toSimpleString`, use the corresponding `fromISOString`, + `fromISOExtString`, or `fromSimpleString` to create a $(LREF SysTime) from the string. -------------------- @@ -69,13 +69,13 @@ auto restoredTime = SysTime.fromISOExtString(timeString); Various functions take a string (or strings) to represent a unit of time (e.g. $(D convert!("days", "hours")(numDays))). The valid strings to use - with such functions are $(D "years"), $(D "months"), $(D "weeks"), - $(D "days"), $(D "hours"), $(D "minutes"), $(D "seconds"), - $(D "msecs") (milliseconds), $(D "usecs") (microseconds), - $(D "hnsecs") (hecto-nanoseconds - i.e. 100 ns), or some subset thereof. - There are a few functions in core.time which take $(D "nsecs"), but because + with such functions are `"years"`, `"months"`, `"weeks"`, + `"days"`, `"hours"`, `"minutes"`, `"seconds"`, + `"msecs"` (milliseconds), `"usecs"` (microseconds), + `"hnsecs"` (hecto-nanoseconds - i.e. 100 ns), or some subset thereof. + There are a few functions in core.time which take `"nsecs"`, but because nothing in std.datetime has precision greater than hnsecs, and very little - in core.time does, no functions in std.datetime accept $(D "nsecs"). + in core.time does, no functions in std.datetime accept `"nsecs"`. To remember which units are abbreviated and which aren't, all units seconds and greater use their full names, and all sub-second units are abbreviated (since they'd be rather long if they @@ -229,24 +229,24 @@ enum Direction } /++ - Used to indicate whether $(D popFront) should be called immediately upon + Used to indicate whether `popFront` should be called immediately upon creating a range. The idea is that for some functions used to generate a - range for an interval, $(D front) is not necessarily a time point which + range for an interval, `front` is not necessarily a time point which would ever be generated by the range. To get the first time point in the range to match what the function generates, then use - $(D PopFirst.yes) to indicate that the range should have $(D popFront) - called on it before the range is returned so that $(D front) is a time point + `PopFirst.yes` to indicate that the range should have `popFront` + called on it before the range is returned so that `front` is a time point which the function would generate. For instance, if the function used to generate a range of time points generated successive Easters (i.e. you're iterating over all of the Easters within the interval), the initial date probably isn't an Easter. Using - $(D PopFirst.yes) would tell the function which returned the - range that $(D popFront) was to be called so that front would then be + `PopFirst.yes` would tell the function which returned the + range that `popFront` was to be called so that front would then be an Easter - the next one generated by the function (which when - iterating forward would be the Easter following the original $(D front), + iterating forward would be the Easter following the original `front`, while when iterating backward, it would be the Easter prior to the - original $(D front)). If $(D PopFirst.no) were used, then $(D front) would + original `front`). If `PopFirst.no` were used, then `front` would remain the original time point and it would not necessarily be a time point which would be generated by the range-generating function (which in many cases is exactly what is desired - @@ -277,12 +277,12 @@ enum AutoStart /++ Array of the strings representing time units, starting with the smallest - unit and going to the largest. It does not include $(D "nsecs"). + unit and going to the largest. It does not include `"nsecs"`. - Includes $(D "hnsecs") (hecto-nanoseconds (100 ns)), - $(D "usecs") (microseconds), $(D "msecs") (milliseconds), $(D "seconds"), - $(D "minutes"), $(D "hours"), $(D "days"), $(D "weeks"), $(D "months"), and - $(D "years") + Includes `"hnsecs"` (hecto-nanoseconds (100 ns)), + `"usecs"` (microseconds), `"msecs"` (milliseconds), `"seconds"`, + `"minutes"`, `"hours"`, `"days"`, `"weeks"`, `"months"`, and + `"years"` +/ immutable string[] timeStrings = ["hnsecs", "usecs", "msecs", "seconds", "minutes", "hours", "days", "weeks", "months", "years"]; @@ -453,9 +453,9 @@ private: //============================================================================== /++ - $(D SysTime) is the type used to get the current time from the + `SysTime` is the type used to get the current time from the system or doing anything that involves time zones. Unlike - $(LREF DateTime), the time zone is an integral part of $(D SysTime) (though for + $(LREF DateTime), the time zone is an integral part of `SysTime` (though for local time applications, time zones can be ignored and it will work, since it defaults to using the local time zone). It holds its internal time in std time (hnsecs since midnight, January 1st, 1 A.D. UTC), @@ -466,32 +466,32 @@ private: For calendar-based operations that don't care about time zones, then $(LREF DateTime) would be the type to - use. For system time, use $(D SysTime). + use. For system time, use `SysTime`. - $(LREF2 .Clock.currTime, Clock.currTime) will return the current time as a $(D SysTime). - To convert a $(D SysTime) to a $(LREF Date) or $(LREF DateTime), simply cast + $(LREF2 .Clock.currTime, Clock.currTime) will return the current time as a `SysTime`. + To convert a `SysTime` to a $(LREF Date) or $(LREF DateTime), simply cast it. To convert a $(LREF Date) or $(LREF DateTime) to a - $(D SysTime), use $(D SysTime)'s constructor, and pass in the + `SysTime`, use `SysTime`'s constructor, and pass in the intended time zone with it (or don't pass in a $(LREF2 .TimeZone, TimeZone), and the local time zone will be used). Be aware, however, that converting from a - $(LREF DateTime) to a $(D SysTime) will not necessarily be 100% accurate due to + $(LREF DateTime) to a `SysTime` will not necessarily be 100% accurate due to DST (one hour of the year doesn't exist and another occurs twice). To not risk any conversion errors, keep times as - $(D SysTime)s. Aside from DST though, there shouldn't be any conversion + `SysTime`s. Aside from DST though, there shouldn't be any conversion problems. For using time zones other than local time or UTC, use $(LREF PosixTimeZone) on Posix systems (or on Windows, if providing the TZ Database files), and use $(LREF WindowsTimeZone) on Windows systems. - The time in $(D SysTime) is kept internally in hnsecs from midnight, + The time in `SysTime` is kept internally in hnsecs from midnight, January 1st, 1 A.D. UTC. Conversion error cannot happen when changing - the time zone of a $(D SysTime). $(LREF LocalTime) is the $(LREF2 .TimeZone, TimeZone) class - which represents the local time, and $(D UTC) is the $(LREF2 .TimeZone, TimeZone) class - which represents UTC. $(D SysTime) uses $(LREF LocalTime) if no $(LREF2 .TimeZone, TimeZone) + the time zone of a `SysTime`. $(LREF LocalTime) is the $(LREF2 .TimeZone, TimeZone) class + which represents the local time, and `UTC` is the $(LREF2 .TimeZone, TimeZone) class + which represents UTC. `SysTime` uses $(LREF LocalTime) if no $(LREF2 .TimeZone, TimeZone) is provided. For more details on time zones, see the documentation for $(LREF2 .TimeZone, TimeZone), $(LREF PosixTimeZone), and $(LREF WindowsTimeZone). - $(D SysTime)'s range is from approximately 29,000 B.C. to approximately + `SysTime`'s range is from approximately 29,000 B.C. to approximately 29,000 A.D. +/ struct SysTime @@ -551,7 +551,7 @@ public: assumed to be in the given time zone. Throws: - $(LREF DateTimeException) if $(D fracSecs) is negative or if it's + $(LREF DateTimeException) if `fracSecs` is negative or if it's greater than or equal to one second. +/ this(in DateTime dateTime, in Duration fracSecs, immutable TimeZone tz = null) @safe @@ -609,7 +609,7 @@ public: assumed to be in the given time zone. Throws: - $(LREF DateTimeException) if $(D fracSec) is negative. + $(LREF DateTimeException) if `fracSec` is negative. +/ //deprecated("Please use the overload which takes a Duration instead of a FracSec.") this(in DateTime dateTime, in FracSec fracSec, immutable TimeZone tz = null) @safe @@ -1043,7 +1043,7 @@ public: Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Throws: - $(LREF DateTimeException) if $(D isAD) is true. + $(LREF DateTimeException) if `isAD` is true. +/ @property ushort yearBC() @safe const { @@ -2101,7 +2101,7 @@ public: fractional seconds to. Throws: - $(LREF DateTimeException) if $(D fracSec) is negative. + $(LREF DateTimeException) if `fracSec` is negative. +/ //deprecated("Please use fracSecs (with an s) rather than fracSec (without an s). It takes a Duration instead of a FracSec, as FracSec is being deprecated.") @property void fracSec(FracSec fracSec) @safe @@ -2300,7 +2300,7 @@ public: /++ Returns a $(LREF SysTime) with the same std time as this one, but with - $(D UTC) as its time zone. + `UTC` as its time zone. +/ SysTime toUTC() @safe const pure nothrow { @@ -2374,7 +2374,7 @@ public: /++ - Returns a $(D timeval) which represents this $(LREF SysTime). + Returns a `timeval` which represents this $(LREF SysTime). Note that like all conversions in std.datetime, this is a truncating conversion. @@ -2418,7 +2418,7 @@ public: /++ - Returns a $(D tm) which represents this $(LREF SysTime). + Returns a `tm` which represents this $(LREF SysTime). +/ tm toTM() @safe const nothrow { @@ -4520,9 +4520,9 @@ public: affect larger units. For instance, rolling a $(LREF SysTime) one year's worth of days gets the exact same $(LREF SysTime). - Accepted units are $(D "days"), $(D "minutes"), $(D "hours"), - $(D "minutes"), $(D "seconds"), $(D "msecs"), $(D "usecs"), and - $(D "hnsecs"). + Accepted units are `"days"`, `"minutes"`, `"hours"`, + `"minutes"`, `"seconds"`, `"msecs"`, `"usecs"`, and + `"hnsecs"`. Note that when rolling msecs, usecs or hnsecs, they all add up to a second. So, for example, rolling 1000 msecs is exactly the same as @@ -7712,7 +7712,7 @@ public: there is no decimal point. If this $(LREF SysTime)'s time zone is $(LREF LocalTime), then TZ is empty. - If its time zone is $(D UTC), then it is "Z". Otherwise, it is the + If its time zone is `UTC`, then it is "Z". Otherwise, it is the offset from UTC (e.g. +1:00 or -7:00). Note that the offset from UTC is $(I not) enough to uniquely identify the time zone. @@ -7842,7 +7842,7 @@ public: there is no decimal point. If this $(LREF SysTime)'s time zone is $(LREF LocalTime), then TZ is empty. If - its time zone is $(D UTC), then it is "Z". Otherwise, it is the offset + its time zone is `UTC`, then it is "Z". Otherwise, it is the offset from UTC (e.g. +1:00 or -7:00). Note that the offset from UTC is $(I not) enough to uniquely identify the time zone. @@ -7976,7 +7976,7 @@ public: there is no decimal point. If this $(LREF SysTime)'s time zone is $(LREF LocalTime), then TZ is empty. If - its time zone is $(D UTC), then it is "Z". Otherwise, it is the offset + its time zone is `UTC`, then it is "Z". Otherwise, it is the offset from UTC (e.g. +1:00 or -7:00). Note that the offset from UTC is $(I not) enough to uniquely identify the time zone. @@ -8124,13 +8124,13 @@ public: YYYYMMDDTHHMMSS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string. - The exact format is exactly as described in $(D toISOString) except that + The exact format is exactly as described in `toISOString` except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid. If there is no time zone in the string, then $(LREF LocalTime) is used. If - the time zone is "Z", then $(D UTC) is used. Otherwise, a + the time zone is "Z", then `UTC` is used. Otherwise, a $(LREF SimpleTimeZone) which corresponds to the given offset from UTC is used. To get the returned $(LREF SysTime) to be a particular time zone, pass in that time zone and the $(LREF SysTime) to be returned @@ -8344,13 +8344,13 @@ public: YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string. - The exact format is exactly as described in $(D toISOExtString) + The exact format is exactly as described in `toISOExtString` except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid. If there is no time zone in the string, then $(LREF LocalTime) is used. If - the time zone is "Z", then $(D UTC) is used. Otherwise, a + the time zone is "Z", then `UTC` is used. Otherwise, a $(LREF SimpleTimeZone) which corresponds to the given offset from UTC is used. To get the returned $(LREF SysTime) to be a particular time zone, pass in that time zone and the $(LREF SysTime) to be returned @@ -8569,13 +8569,13 @@ public: YYYY-MM-DD HH:MM:SS.FFFFFFFTZ (where F is fractional seconds is the time zone). Whitespace is stripped from the given string. - The exact format is exactly as described in $(D toSimpleString) except + The exact format is exactly as described in `toSimpleString` except that trailing zeroes are permitted - including having fractional seconds with all zeroes. However, a decimal point with nothing following it is invalid. If there is no time zone in the string, then $(LREF LocalTime) is used. If - the time zone is "Z", then $(D UTC) is used. Otherwise, a + the time zone is "Z", then `UTC` is used. Otherwise, a $(LREF SimpleTimeZone) which corresponds to the given offset from UTC is used. To get the returned $(LREF SysTime) to be a particular time zone, pass in that time zone and the $(LREF SysTime) to be returned @@ -8588,7 +8588,7 @@ public: Params: simpleString = A string formatted in the way that - $(D toSimpleString) formats dates and times. + `toSimpleString` formats dates and times. tz = The time zone to convert the given time to (no conversion occurs if null). @@ -8829,7 +8829,7 @@ public: private: /+ - Returns $(D stdTime) converted to $(LREF SysTime)'s time zone. + Returns `stdTime` converted to $(LREF SysTime)'s time zone. +/ @property long adjTime() @safe const nothrow { @@ -8867,10 +8867,10 @@ private: 32,768 B.C. to 32,767 A.D. Positive years are A.D. Non-positive years are B.C. - Year, month, and day are kept separately internally so that $(D Date) is + Year, month, and day are kept separately internally so that `Date` is optimized for calendar-based operations. - $(D Date) uses the Proleptic Gregorian Calendar, so it assumes the Gregorian + `Date` uses the Proleptic Gregorian Calendar, so it assumes the Gregorian leap year calculations for its entire length. As per $(WEB en.wikipedia.org/wiki/ISO_8601, ISO 8601), it treats 1 B.C. as year 0, i.e. 1 B.C. is 0, 2 B.C. is -1, etc. Use $(LREF yearBC) to use B.C. as @@ -9299,7 +9299,7 @@ public: Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Throws: - $(LREF DateTimeException) if $(D isAD) is true. + $(LREF DateTimeException) if `isAD` is true. +/ @property ushort yearBC() @safe const pure { @@ -11015,10 +11015,10 @@ public: affect larger units. For instance, rolling a $(LREF Date) one year's worth of days gets the exact same $(LREF Date). - The only accepted units are $(D "days"). + The only accepted units are `"days"`. Params: - units = The units to add. Must be $(D "days"). + units = The units to add. Must be `"days"`. days = The number of days to add to this $(LREF Date). +/ ref Date roll(string units)(long days) @safe pure nothrow @@ -13419,7 +13419,7 @@ public: one hours's worth of minutes gets the exact same $(LREF TimeOfDay). - Accepted units are $(D "hours"), $(D "minutes"), and $(D "seconds"). + Accepted units are `"hours"`, `"minutes"`, and `"seconds"`. Params: units = The units to add. @@ -14354,7 +14354,7 @@ private: operations and has no concept of time zone. For an object which is optimized for time operations based on the system time, use $(LREF SysTime). $(LREF SysTime) has a concept of time zone and has much higher - precision (hnsecs). $(D DateTime) is intended primarily for calendar-based + precision (hnsecs). `DateTime` is intended primarily for calendar-based uses rather than precise time operations. +/ struct DateTime @@ -14426,7 +14426,7 @@ public: /++ - Compares this $(LREF DateTime) with the given $(D DateTime.). + Compares this $(LREF DateTime) with the given `DateTime.`. Returns: $(BOOKTABLE, @@ -14816,7 +14816,7 @@ public: Year B.C. of the Gregorian Calendar counting year 0 as 1 B.C. Throws: - $(LREF DateTimeException) if $(D isAD) is true. + $(LREF DateTimeException) if `isAD` is true. +/ @property short yearBC() @safe const pure { @@ -15380,8 +15380,8 @@ public: affect larger units. For instance, rolling a $(LREF DateTime) one year's worth of days gets the exact same $(LREF DateTime). - Accepted units are $(D "days"), $(D "minutes"), $(D "hours"), - $(D "minutes"), and $(D "seconds"). + Accepted units are `"days"`, `"minutes"`, `"hours"`, + `"minutes"`, and `"seconds"`. Params: units = The units to add. @@ -17356,7 +17356,7 @@ private: /++ Represents an interval of time. - An $(D Interval) has a starting point and an end point. The interval of time + An `Interval` has a starting point and an end point. The interval of time is therefore the time starting at the starting point up to, but not including, the end point. e.g. @@ -17366,7 +17366,7 @@ private: $(TR $(TD [1982-01-04T08:59:00 - 2010-07-04T12:00:00$(RPAREN))) ) - A range can be obtained from an $(D Interval), allowing iteration over + A range can be obtained from an `Interval`, allowing iteration over that interval, with the exact time points which are iterated over depending on the function which generates the range. +/ @@ -17405,8 +17405,8 @@ Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)); duration = The duration from the starting point to the end point. Throws: - $(LREF DateTimeException) if the resulting $(D end) is before - $(D begin). + $(LREF DateTimeException) if the resulting `end` is before + `begin`. Examples: -------------------- @@ -17468,7 +17468,7 @@ assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).begin == The starting point of the interval. It is included in the interval. Params: - timePoint = The time point to set $(D begin) to. + timePoint = The time point to set `begin` to. Throws: $(LREF DateTimeException) if the resulting interval would be invalid. @@ -17516,7 +17516,7 @@ assert(Interval!Date(Date(1996, 1, 2), Date(2012, 3, 1)).end == /++ - Returns the duration between $(D begin) and $(D end). + Returns the duration between `begin` and `end`. Examples: -------------------- @@ -18391,14 +18391,14 @@ assert(interval2 == Interval!Date(Date(1995, 11, 13), Date(2012, 2, 15))); of years and/or months (a positive number of years and months shifts the interval forward; a negative number shifts it backward). It adds the years the given years and months to both begin and end. - It effectively calls $(D add!"years"()) and then $(D add!"months"()) + It effectively calls `add!"years"()` and then `add!"months"()` on begin and end with the given number of years and months. Params: years = The number of years to shift the interval by. months = The number of months to shift the interval by. allowOverflow = Whether the days should be allowed to overflow - on $(D begin) and $(D end), causing their month + on `begin` and `end`, causing their month to increment. Throws: @@ -18514,15 +18514,15 @@ assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1))); { /++ Expands the interval forwards and/or backwards in time. Effectively, - it subtracts the given number of months/years from $(D begin) and - adds them to $(D end). Whether it expands forwards and/or backwards + it subtracts the given number of months/years from `begin` and + adds them to `end`. Whether it expands forwards and/or backwards in time is determined by $(D_PARAM dir). Params: years = The number of years to expand the interval by. months = The number of months to expand the interval by. allowOverflow = Whether the days should be allowed to overflow - on $(D begin) and $(D end), causing their month + on `begin` and `end`, causing their month to increment. dir = The direction in time to expand the interval. @@ -18598,29 +18598,29 @@ assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1))); /++ Returns a range which iterates forward over the interval, starting - at $(D begin), using $(D_PARAM func) to generate each successive time + at `begin`, using $(D_PARAM func) to generate each successive time point. - The range's $(D front) is the interval's $(D begin). $(D_PARAM func) is - used to generate the next $(D front) when $(D popFront) is called. If - $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called - before the range is returned (so that $(D front) is a time point which + The range's `front` is the interval's `begin`. $(D_PARAM func) is + used to generate the next `front` when `popFront` is called. If + $(D_PARAM popFirst) is `PopFirst.yes`, then `popFront` is called + before the range is returned (so that `front` is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point less than or equal to the - current $(D front) of the range, then a $(LREF DateTimeException) will be + current `front` of the range, then a $(LREF DateTimeException) will be thrown. The range will be empty and iteration complete when - $(D_PARAM func) generates a time point equal to or beyond the $(D end) + $(D_PARAM func) generates a time point equal to or beyond the `end` of the interval. There are helper functions in this module which generate common - delegates to pass to $(D fwdRange). Their documentation starts with + delegates to pass to `fwdRange`. Their documentation starts with "Range-generating function," making them easily searchable. Params: func = The function used to generate the time points of the range over the interval. - popFirst = Whether $(D popFront) should be called on the range + popFirst = Whether `popFront` should be called on the range before returning it. Throws: @@ -18631,14 +18631,14 @@ assert(interval2 == Interval!Date(Date(1998, 1, 2), Date(2010, 3, 1))); would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate - functions to pass to $(D fwdRange), $(D_PARAM func) must be a + functions to pass to `fwdRange`, $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's - $(D save) will have failed to have really saved the range's state. + `save` will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is - not logically pure to $(D fwdRange). If $(D_PARAM func) is given the + not logically pure to `fwdRange`. If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. @@ -18691,29 +18691,29 @@ assert(range.empty); /++ Returns a range which iterates backwards over the interval, starting - at $(D end), using $(D_PARAM func) to generate each successive time + at `end`, using $(D_PARAM func) to generate each successive time point. - The range's $(D front) is the interval's $(D end). $(D_PARAM func) is - used to generate the next $(D front) when $(D popFront) is called. If - $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called - before the range is returned (so that $(D front) is a time point which + The range's `front` is the interval's `end`. $(D_PARAM func) is + used to generate the next `front` when `popFront` is called. If + $(D_PARAM popFirst) is `PopFirst.yes`, then `popFront` is called + before the range is returned (so that `front` is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point greater than or equal to - the current $(D front) of the range, then a $(LREF DateTimeException) will + the current `front` of the range, then a $(LREF DateTimeException) will be thrown. The range will be empty and iteration complete when $(D_PARAM func) generates a time point equal to or less than the - $(D begin) of the interval. + `begin` of the interval. There are helper functions in this module which generate common - delegates to pass to $(D bwdRange). Their documentation starts with + delegates to pass to `bwdRange`. Their documentation starts with "Range-generating function," making them easily searchable. Params: func = The function used to generate the time points of the range over the interval. - popFirst = Whether $(D popFront) should be called on the range + popFirst = Whether `popFront` should be called on the range before returning it. Throws: @@ -18724,14 +18724,14 @@ assert(range.empty); would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate - functions to pass to $(D fwdRange), $(D_PARAM func) must be a + functions to pass to `fwdRange`, $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's - $(D save) will have failed to have really saved the range's state. + `save` will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is - not logically pure to $(D fwdRange). If $(D_PARAM func) is given the + not logically pure to `fwdRange`. If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. @@ -20277,8 +20277,8 @@ unittest /++ Represents an interval of time which has positive infinity as its end point. - Any ranges which iterate over a $(D PosInfInterval) are infinite. So, the - main purpose of using $(D PosInfInterval) is to create an infinite range + Any ranges which iterate over a `PosInfInterval` are infinite. So, the + main purpose of using `PosInfInterval` is to create an infinite range which starts at a fixed point in time and goes to positive infinity. +/ struct PosInfInterval(TP) @@ -20302,7 +20302,7 @@ auto interval = PosInfInterval!Date(Date(1996, 1, 2)); /++ Params: - rhs = The $(D PosInfInterval) to assign to this one. + rhs = The `PosInfInterval` to assign to this one. +/ ref PosInfInterval opAssign(const ref PosInfInterval rhs) pure nothrow { @@ -20313,7 +20313,7 @@ auto interval = PosInfInterval!Date(Date(1996, 1, 2)); /++ Params: - rhs = The $(D PosInfInterval) to assign to this one. + rhs = The `PosInfInterval` to assign to this one. +/ ref PosInfInterval opAssign(PosInfInterval rhs) pure nothrow { @@ -20340,7 +20340,7 @@ assert(PosInfInterval!Date(Date(1996, 1, 2)).begin == Date(1996, 1, 2)); The starting point of the interval. It is included in the interval. Params: - timePoint = The time point to set $(D begin) to. + timePoint = The time point to set `begin` to. +/ @property void begin(TP timePoint) pure nothrow { @@ -20894,8 +20894,8 @@ assert(!PosInfInterval!Date(Date(1996, 1, 2)).isAdjacent( not adjacent or if the given interval is empty. Note: - There is no overload for $(D merge) which takes a - $(D NegInfInterval), because an interval + There is no overload for `merge` which takes a + `NegInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -20928,8 +20928,8 @@ assert(PosInfInterval!Date(Date(1996, 1, 2)).merge( interval = The interval to merge with this interval. Note: - There is no overload for $(D merge) which takes a - $(D NegInfInterval), because an interval + There is no overload for `merge` which takes a + `NegInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -20963,8 +20963,8 @@ assert(PosInfInterval!Date(Date(1996, 1, 2)).merge( $(LREF DateTimeException) if the given interval is empty. Note: - There is no overload for $(D span) which takes a - $(D NegInfInterval), because an interval + There is no overload for `span` which takes a + `NegInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -21001,8 +21001,8 @@ assert(PosInfInterval!Date(Date(1996, 1, 2)).span( interval. Note: - There is no overload for $(D span) which takes a - $(D NegInfInterval), because an interval + There is no overload for `span` which takes a + `NegInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -21024,7 +21024,7 @@ assert(PosInfInterval!Date(Date(1996, 1, 2)).span( /++ - Shifts the $(D begin) of this interval forward or backwards in time by + Shifts the `begin` of this interval forward or backwards in time by the given duration (a positive duration shifts the interval forward; a negative duration shifts it backward). Effectively, it does $(D begin += duration). @@ -21055,19 +21055,19 @@ assert(interval2 == PosInfInterval!Date(Date(1995, 11, 13))); __traits(compiles, begin.add!"years"(1))) { /++ - Shifts the $(D begin) of this interval forward or backwards in time + Shifts the `begin` of this interval forward or backwards in time by the given number of years and/or months (a positive number of years and months shifts the interval forward; a negative number shifts it backward). It adds the years the given years and months to - $(D begin). It effectively calls $(D add!"years"()) and then - $(D add!"months"()) on $(D begin) with the given number of years and + `begin`. It effectively calls `add!"years"()` and then + `add!"months"()` on `begin` with the given number of years and months. Params: years = The number of years to shift the interval by. months = The number of months to shift the interval by. allowOverflow = Whether the days should be allowed to overflow - on $(D begin), causing its month to increment. + on `begin`, causing its month to increment. Throws: $(LREF DateTimeException) if this interval is empty or if the @@ -21129,13 +21129,13 @@ assert(interval2 == PosInfInterval!Date(Date(1996, 1, 4))); { /++ Expands the interval forwards and/or backwards in time. Effectively, - it subtracts the given number of months/years from $(D begin). + it subtracts the given number of months/years from `begin`. Params: years = The number of years to expand the interval by. months = The number of months to expand the interval by. allowOverflow = Whether the days should be allowed to overflow - on $(D begin), causing its month to increment. + on `begin`, causing its month to increment. Throws: $(LREF DateTimeException) if this interval is empty or if the @@ -21170,27 +21170,27 @@ assert(interval2 == PosInfInterval!Date(Date(1998, 1, 2))); /++ Returns a range which iterates forward over the interval, starting - at $(D begin), using $(D_PARAM func) to generate each successive time + at `begin`, using $(D_PARAM func) to generate each successive time point. - The range's $(D front) is the interval's $(D begin). $(D_PARAM func) is - used to generate the next $(D front) when $(D popFront) is called. If - $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called - before the range is returned (so that $(D front) is a time point which + The range's `front` is the interval's `begin`. $(D_PARAM func) is + used to generate the next `front` when `popFront` is called. If + $(D_PARAM popFirst) is `PopFirst.yes`, then `popFront` is called + before the range is returned (so that `front` is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point less than or equal to the - current $(D front) of the range, then a $(LREF DateTimeException) will be + current `front` of the range, then a $(LREF DateTimeException) will be thrown. There are helper functions in this module which generate common - delegates to pass to $(D fwdRange). Their documentation starts with + delegates to pass to `fwdRange`. Their documentation starts with "Range-generating function," to make them easily searchable. Params: func = The function used to generate the time points of the range over the interval. - popFirst = Whether $(D popFront) should be called on the range + popFirst = Whether `popFront` should be called on the range before returning it. Throws: @@ -21201,14 +21201,14 @@ assert(interval2 == PosInfInterval!Date(Date(1998, 1, 2))); would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate - functions to pass to $(D fwdRange), $(D_PARAM func) must be a + functions to pass to `fwdRange`, $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's - $(D save) will have failed to have really saved the range's state. + `save` will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is - not logically pure to $(D fwdRange). If $(D_PARAM func) is given the + not logically pure to `fwdRange`. If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. @@ -22468,8 +22468,8 @@ unittest Represents an interval of time which has negative infinity as its starting point. - Any ranges which iterate over a $(D NegInfInterval) are infinite. So, the - main purpose of using $(D NegInfInterval) is to create an infinite range + Any ranges which iterate over a `NegInfInterval` are infinite. So, the + main purpose of using `NegInfInterval` is to create an infinite range which starts at negative infinity and goes to a fixed end point. Iterate over it in reverse. +/ @@ -22494,7 +22494,7 @@ auto interval = PosInfInterval!Date(Date(1996, 1, 2)); /++ Params: - rhs = The $(D NegInfInterval) to assign to this one. + rhs = The `NegInfInterval` to assign to this one. +/ ref NegInfInterval opAssign(const ref NegInfInterval rhs) pure nothrow { @@ -22505,7 +22505,7 @@ auto interval = PosInfInterval!Date(Date(1996, 1, 2)); /++ Params: - rhs = The $(D NegInfInterval) to assign to this one. + rhs = The `NegInfInterval` to assign to this one. +/ ref NegInfInterval opAssign(NegInfInterval rhs) pure nothrow { @@ -23101,8 +23101,8 @@ assert(!NegInfInterval!Date(Date(2012, 3, 1)).isAdjacent( not adjacent or if the given interval is empty. Note: - There is no overload for $(D merge) which takes a - $(D PosInfInterval), because an interval + There is no overload for `merge` which takes a + `PosInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -23135,8 +23135,8 @@ assert(NegInfInterval!Date(Date(2012, 3, 1)).merge( interval = The interval to merge with this interval. Note: - There is no overload for $(D merge) which takes a - $(D PosInfInterval), because an interval + There is no overload for `merge` which takes a + `PosInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -23170,8 +23170,8 @@ assert(NegInfInterval!Date(Date(2012, 3, 1)).merge( $(LREF DateTimeException) if the given interval is empty. Note: - There is no overload for $(D span) which takes a - $(D PosInfInterval), because an interval + There is no overload for `span` which takes a + `PosInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -23208,8 +23208,8 @@ assert(NegInfInterval!Date(Date(1600, 1, 7)).span( interval. Note: - There is no overload for $(D span) which takes a - $(D PosInfInterval), because an interval + There is no overload for `span` which takes a + `PosInfInterval`, because an interval going from negative infinity to positive infinity is not possible. @@ -23231,7 +23231,7 @@ assert(NegInfInterval!Date(Date(2012, 3, 1)).span( /++ - Shifts the $(D end) of this interval forward or backwards in time by the + Shifts the `end` of this interval forward or backwards in time by the given duration (a positive duration shifts the interval forward; a negative duration shifts it backward). Effectively, it does $(D end += duration). @@ -23262,18 +23262,18 @@ assert(interval2 == NegInfInterval!Date( Date(2012, 2, 15))); __traits(compiles, end.add!"years"(1))) { /++ - Shifts the $(D end) of this interval forward or backwards in time by + Shifts the `end` of this interval forward or backwards in time by the given number of years and/or months (a positive number of years and months shifts the interval forward; a negative number shifts it backward). It adds the years the given years and months to end. It - effectively calls $(D add!"years"()) and then $(D add!"months"()) + effectively calls `add!"years"()` and then `add!"months"()` on end with the given number of years and months. Params: years = The number of years to shift the interval by. months = The number of months to shift the interval by. allowOverflow = Whether the days should be allowed to overflow - on $(D end), causing its month to increment. + on `end`, causing its month to increment. Throws: $(LREF DateTimeException) if empty is true or if the resulting @@ -23341,7 +23341,7 @@ assert(interval2 == NegInfInterval!Date(Date(2012, 2, 28))); years = The number of years to expand the interval by. months = The number of months to expand the interval by. allowOverflow = Whether the days should be allowed to overflow - on $(D end), causing their month to increment. + on `end`, causing their month to increment. Throws: $(LREF DateTimeException) if empty is true or if the resulting @@ -23376,27 +23376,27 @@ assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1))); /++ Returns a range which iterates backwards over the interval, starting - at $(D end), using $(D_PARAM func) to generate each successive time + at `end`, using $(D_PARAM func) to generate each successive time point. - The range's $(D front) is the interval's $(D end). $(D_PARAM func) is - used to generate the next $(D front) when $(D popFront) is called. If - $(D_PARAM popFirst) is $(D PopFirst.yes), then $(D popFront) is called - before the range is returned (so that $(D front) is a time point which + The range's `front` is the interval's `end`. $(D_PARAM func) is + used to generate the next `front` when `popFront` is called. If + $(D_PARAM popFirst) is `PopFirst.yes`, then `popFront` is called + before the range is returned (so that `front` is a time point which $(D_PARAM func) would generate). If $(D_PARAM func) ever generates a time point greater than or equal to - the current $(D front) of the range, then a $(LREF DateTimeException) will + the current `front` of the range, then a $(LREF DateTimeException) will be thrown. There are helper functions in this module which generate common - delegates to pass to $(D bwdRange). Their documentation starts with + delegates to pass to `bwdRange`. Their documentation starts with "Range-generating function," to make them easily searchable. Params: func = The function used to generate the time points of the range over the interval. - popFirst = Whether $(D popFront) should be called on the range + popFirst = Whether `popFront` should be called on the range before returning it. Throws: @@ -23407,14 +23407,14 @@ assert(interval2 == NegInfInterval!Date(Date(2010, 3, 1))); would be a function pointer to a pure function, but forcing $(D_PARAM func) to be pure is far too restrictive to be useful, and in order to have the ease of use of having functions which generate - functions to pass to $(D fwdRange), $(D_PARAM func) must be a + functions to pass to `fwdRange`, $(D_PARAM func) must be a delegate. If $(D_PARAM func) retains state which changes as it is called, then some algorithms will not work correctly, because the range's - $(D save) will have failed to have really saved the range's state. + `save` will have failed to have really saved the range's state. To avoid such bugs, don't pass a delegate which is - not logically pure to $(D fwdRange). If $(D_PARAM func) is given the + not logically pure to `fwdRange`. If $(D_PARAM func) is given the same time point with two different calls, it must return the same result both times. @@ -24682,17 +24682,17 @@ unittest Range-generating function. Returns a delegate which returns the next time point with the given - $(D DayOfWeek) in a range. + `DayOfWeek` in a range. Using this delegate allows iteration over successive time points which - are all the same day of the week. e.g. passing $(D DayOfWeek.mon) to - $(D everyDayOfWeek) would result in a delegate which could be used to + are all the same day of the week. e.g. passing `DayOfWeek.mon` to + `everyDayOfWeek` would result in a delegate which could be used to iterate over all of the Mondays in a range. Params: dir = The direction to iterate in. If passing the return value to - $(D fwdRange), use $(D Direction.fwd). If passing it to - $(D bwdRange), use $(D Direction.bwd). + `fwdRange`, use `Direction.fwd`. If passing it to + `bwdRange`, use `Direction.bwd`. dayOfWeek = The week that each time point in the range will be. +/ static TP delegate(in TP) everyDayOfWeek(TP, Direction dir = Direction.fwd)(DayOfWeek dayOfWeek) nothrow @@ -24785,18 +24785,18 @@ unittest So, using this delegate allows iteration over successive time points which are in the same month but different years. For example, iterate over each successive December 25th in an interval by starting with a - date which had the 25th as its day and passed $(D Month.dec) to - $(D everyMonth) to create the delegate. + date which had the 25th as its day and passed `Month.dec` to + `everyMonth` to create the delegate. Since it wouldn't really make sense to be iterating over a specific month and end up with some of the time points in the succeeding month or two years - after the previous time point, $(D AllowDayOverflow.no) is always used when + after the previous time point, `AllowDayOverflow.no` is always used when calculating the next time point. Params: dir = The direction to iterate in. If passing the return value to - $(D fwdRange), use $(D Direction.fwd). If passing it to - $(D bwdRange), use $(D Direction.bwd). + `fwdRange`, use `Direction.fwd`. If passing it to + `bwdRange`, use `Direction.bwd`. month = The month that each time point in the range will be in. +/ static TP delegate(in TP) everyMonth(TP, Direction dir = Direction.fwd)(int month) @@ -24911,14 +24911,14 @@ unittest duration later. Using this delegate allows iteration over successive time points which - are apart by the given duration e.g. passing $(D dur!"days"(3)) to - $(D everyDuration) would result in a delegate which could be used to iterate + are apart by the given duration e.g. passing `dur!"days"(3)` to + `everyDuration` would result in a delegate which could be used to iterate over a range of days which are each 3 days apart. Params: dir = The direction to iterate in. If passing the return value to - $(D fwdRange), use $(D Direction.fwd). If passing it to - $(D bwdRange), use $(D Direction.bwd). + `fwdRange`, use `Direction.fwd`. If passing it to + `bwdRange`, use `Direction.bwd`. duration = The duration which separates each successive time point in the range. +/ @@ -24990,34 +24990,34 @@ unittest Returns a delegate which returns the next time point which is the given number of years, month, and duration later. - The difference between this version of $(D everyDuration) and the version + The difference between this version of `everyDuration` and the version which just takes a $(CXREF time, Duration) is that this one also takes the number of - years and months (along with an $(D AllowDayOverflow) to indicate whether + years and months (along with an `AllowDayOverflow` to indicate whether adding years and months should allow the days to overflow). - Note that if iterating forward, $(D add!"years"()) is called on the given - time point, then $(D add!"months"()), and finally the duration is added + Note that if iterating forward, `add!"years"()` is called on the given + time point, then `add!"months"()`, and finally the duration is added to it. However, if iterating backwards, the duration is added first, then - $(D add!"months"()) is called, and finally $(D add!"years"()) is called. + `add!"months"()` is called, and finally `add!"years"()` is called. That way, going backwards generates close to the same time points that iterating forward does, but since adding years and months is not entirely reversible (due to possible day overflow, regardless of whether - $(D AllowDayOverflow.yes) or $(D AllowDayOverflow.no) is used), it can't be + `AllowDayOverflow.yes` or `AllowDayOverflow.no` is used), it can't be guaranteed that iterating backwards will give the same time points as iterating forward would have (even assuming that the end of the range is a time point which would be returned by the delegate when iterating forward - from $(D begin)). + from `begin`). Params: dir = The direction to iterate in. If passing the return - value to $(D fwdRange), use $(D Direction.fwd). If - passing it to $(D bwdRange), use $(D Direction.bwd). + value to `fwdRange`, use `Direction.fwd`. If + passing it to `bwdRange`, use `Direction.bwd`. years = The number of years to add to the time point passed to the delegate. months = The number of months to add to the time point passed to the delegate. allowOverflow = Whether the days should be allowed to overflow on - $(D begin) and $(D end), causing their month to + `begin` and `end`, causing their month to increment. duration = The duration to add to the time point passed to the delegate. @@ -25140,23 +25140,23 @@ unittest /++ A range over an $(LREF2 .Interval, Interval). - $(D IntervalRange) is only ever constructed by $(LREF2 .Interval, Interval). However, when - it is constructed, it is given a function, $(D func), which is used to - generate the time points which are iterated over. $(D func) takes a time + `IntervalRange` is only ever constructed by $(LREF2 .Interval, Interval). However, when + it is constructed, it is given a function, `func`, which is used to + generate the time points which are iterated over. `func` takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in - the interval $(D Interval!Date), pass a function to $(LREF2 .Interval, Interval)'s $(D fwdRange) + the interval `Interval!Date`, pass a function to $(LREF2 .Interval, Interval)'s `fwdRange` where that function took a $(LREF Date) and returned a $(LREF Date) which was one - day later. That function would then be used by $(D IntervalRange)'s - $(D popFront) to iterate over the $(LREF Date)s in the interval. + day later. That function would then be used by `IntervalRange`'s + `popFront` to iterate over the $(LREF Date)s in the interval. If $(D dir == Direction.fwd), then a range iterates forward in time, whereas if $(D dir == Direction.bwd), then it iterates backwards in time. So, if $(D dir == Direction.fwd) then $(D front == interval.begin), whereas if - $(D dir == Direction.bwd) then $(D front == interval.end). $(D func) must + $(D dir == Direction.bwd) then $(D front == interval.end). `func` must generate a time point going in the proper direction of iteration, or a $(LREF DateTimeException) will be thrown. So, to iterate forward in - time, the time point that $(D func) generates must be later in time than the + time, the time point that `func` generates must be later in time than the one passed to it. If it's either identical or earlier in time, then a $(LREF DateTimeException) will be thrown. To iterate backwards, then the generated time point must be before the time point which was passed in. @@ -25164,20 +25164,20 @@ unittest If the generated time point is ever passed the edge of the range in the proper direction, then the edge of that range will be used instead. So, if iterating forward, and the generated time point is past the interval's - $(D end), then $(D front) becomes $(D end). If iterating backwards, and the - generated time point is before $(D begin), then $(D front) becomes - $(D begin). In either case, the range would then be empty. + `end`, then `front` becomes `end`. If iterating backwards, and the + generated time point is before `begin`, then `front` becomes + `begin`. In either case, the range would then be empty. - Also note that while normally the $(D begin) of an interval is included in - it and its $(D end) is excluded from it, if $(D dir == Direction.bwd), then - $(D begin) is treated as excluded and $(D end) is treated as included. This + Also note that while normally the `begin` of an interval is included in + it and its `end` is excluded from it, if $(D dir == Direction.bwd), then + `begin` is treated as excluded and `end` is treated as included. This allows for the same behavior in both directions. This works because none of - $(LREF2 .Interval, Interval)'s functions which care about whether $(D begin) or $(D end) is - included or excluded are ever called by $(D IntervalRange). $(D interval) + $(LREF2 .Interval, Interval)'s functions which care about whether `begin` or `end` is + included or excluded are ever called by `IntervalRange`. `interval` returns a normal interval, regardless of whether $(D dir == Direction.fwd) or if $(D dir == Direction.bwd), so any $(LREF2 .Interval, Interval) functions which are - called on it which care about whether $(D begin) or $(D end) are included or - excluded will treat $(D begin) as included and $(D end) as excluded. + called on it which care about whether `begin` or `end` are included or + excluded will treat `begin` as included and `end` as excluded. +/ struct IntervalRange(TP, Direction dir) if(isTimePoint!TP && dir != Direction.both) @@ -25186,7 +25186,7 @@ public: /++ Params: - rhs = The $(D IntervalRange) to assign to this one. + rhs = The `IntervalRange` to assign to this one. +/ ref IntervalRange opAssign(ref IntervalRange rhs) pure nothrow { @@ -25204,7 +25204,7 @@ public: /++ - Whether this $(D IntervalRange) is empty. + Whether this `IntervalRange` is empty. +/ @property bool empty() const pure nothrow { @@ -25230,20 +25230,20 @@ public: /++ - Pops $(D front) from the range, using $(D func) to generate the next + Pops `front` from the range, using `func` to generate the next time point in the range. If the generated time point is beyond the edge - of the range, then $(D front) is set to that edge, and the range is then + of the range, then `front` is set to that edge, and the range is then empty. So, if iterating forwards, and the generated time point is - greater than the interval's $(D end), then $(D front) is set to - $(D end). If iterating backwards, and the generated time point is less - than the interval's $(D begin), then $(D front) is set to $(D begin). + greater than the interval's `end`, then `front` is set to + `end`. If iterating backwards, and the generated time point is less + than the interval's `begin`, then `front` is set to `begin`. Throws: $(LREF DateTimeException) if the range is empty or if the generated time point is in the wrong direction (i.e. if iterating - forward and the generated time point is before $(D front), or if + forward and the generated time point is before `front`, or if iterating backwards and the generated time point is after - $(D front)). + `front`). +/ void popFront() { @@ -25275,7 +25275,7 @@ public: /++ - Returns a copy of $(D this). + Returns a copy of `this`. +/ @property IntervalRange save() pure nothrow { @@ -25284,7 +25284,7 @@ public: /++ - The interval that this $(D IntervalRange) currently covers. + The interval that this `IntervalRange` currently covers. +/ @property Interval!TP interval() const pure nothrow { @@ -25302,7 +25302,7 @@ public: /++ - The $(D Direction) that this range iterates in. + The `Direction` that this range iterates in. +/ @property Direction direction() const pure nothrow { @@ -25655,25 +25655,25 @@ unittest /++ - A range over a $(D PosInfInterval). It is an infinite range. + A range over a `PosInfInterval`. It is an infinite range. - $(D PosInfIntervalRange) is only ever constructed by $(D PosInfInterval). - However, when it is constructed, it is given a function, $(D func), which - is used to generate the time points which are iterated over. $(D func) + `PosInfIntervalRange` is only ever constructed by `PosInfInterval`. + However, when it is constructed, it is given a function, `func`, which + is used to generate the time points which are iterated over. `func` takes a time point and returns a time point of the same type. For instance, to iterate - over all of the days in the interval $(D PosInfInterval!Date), pass a function to - $(D PosInfInterval)'s $(D fwdRange) where that function took a $(LREF Date) and + over all of the days in the interval `PosInfInterval!Date`, pass a function to + `PosInfInterval`'s `fwdRange` where that function took a $(LREF Date) and returned a $(LREF Date) which was one day later. That function would then be - used by $(D PosInfIntervalRange)'s $(D popFront) to iterate over the + used by `PosInfIntervalRange`'s `popFront` to iterate over the $(LREF Date)s in the interval - though obviously, since the range is infinite, - use a function such as $(D std.range.take) with it rather than + use a function such as `std.range.take` with it rather than iterating over $(I all) of the dates. As the interval goes to positive infinity, the range is always iterated over - forwards, never backwards. $(D func) must generate a time point going in + forwards, never backwards. `func` must generate a time point going in the proper direction of iteration, or a $(LREF DateTimeException) will be - thrown. So, the time points that $(D func) generates must be later in time + thrown. So, the time points that `func` generates must be later in time than the one passed to it. If it's either identical or earlier in time, then a $(LREF DateTimeException) will be thrown. +/ @@ -25684,7 +25684,7 @@ public: /++ Params: - rhs = The $(D PosInfIntervalRange) to assign to this one. + rhs = The `PosInfIntervalRange` to assign to this one. +/ ref PosInfIntervalRange opAssign(ref PosInfIntervalRange rhs) pure nothrow { @@ -25718,12 +25718,12 @@ public: /++ - Pops $(D front) from the range, using $(D func) to generate the next + Pops `front` from the range, using `func` to generate the next time point in the range. Throws: $(LREF DateTimeException) if the generated time point is less than - $(D front). + `front`. +/ void popFront() { @@ -25736,7 +25736,7 @@ public: /++ - Returns a copy of $(D this). + Returns a copy of `this`. +/ @property PosInfIntervalRange save() pure nothrow { @@ -25934,36 +25934,36 @@ unittest /++ - A range over a $(D NegInfInterval). It is an infinite range. + A range over a `NegInfInterval`. It is an infinite range. - $(D NegInfIntervalRange) is only ever constructed by $(D NegInfInterval). - However, when it is constructed, it is given a function, $(D func), which - is used to generate the time points which are iterated over. $(D func) + `NegInfIntervalRange` is only ever constructed by `NegInfInterval`. + However, when it is constructed, it is given a function, `func`, which + is used to generate the time points which are iterated over. `func` takes a time point and returns a time point of the same type. For instance, to iterate - over all of the days in the interval $(D NegInfInterval!Date), pass a function to - $(D NegInfInterval)'s $(D bwdRange) where that function took a $(LREF Date) and + over all of the days in the interval `NegInfInterval!Date`, pass a function to + `NegInfInterval`'s `bwdRange` where that function took a $(LREF Date) and returned a $(LREF Date) which was one day earlier. That function would then be - used by $(D NegInfIntervalRange)'s $(D popFront) to iterate over the + used by `NegInfIntervalRange`'s `popFront` to iterate over the $(LREF Date)s in the interval - though obviously, since the range is infinite, - use a function such as $(D std.range.take) with it rather than + use a function such as `std.range.take` with it rather than iterating over $(I all) of the dates. As the interval goes to negative infinity, the range is always iterated over - backwards, never forwards. $(D func) must generate a time point going in + backwards, never forwards. `func` must generate a time point going in the proper direction of iteration, or a $(LREF DateTimeException) will be - thrown. So, the time points that $(D func) generates must be earlier in time + thrown. So, the time points that `func` generates must be earlier in time than the one passed to it. If it's either identical or later in time, then a $(LREF DateTimeException) will be thrown. - Also note that while normally the $(D end) of an interval is excluded from - it, $(D NegInfIntervalRange) treats it as if it were included. This allows - for the same behavior as with $(D PosInfIntervalRange). This works - because none of $(D NegInfInterval)'s functions which care about whether - $(D end) is included or excluded are ever called by - $(D NegInfIntervalRange). $(D interval) returns a normal interval, so any - $(D NegInfInterval) functions which are called on it which care about - whether $(D end) is included or excluded will treat $(D end) as excluded. + Also note that while normally the `end` of an interval is excluded from + it, `NegInfIntervalRange` treats it as if it were included. This allows + for the same behavior as with `PosInfIntervalRange`. This works + because none of `NegInfInterval`'s functions which care about whether + `end` is included or excluded are ever called by + `NegInfIntervalRange`. `interval` returns a normal interval, so any + `NegInfInterval` functions which are called on it which care about + whether `end` is included or excluded will treat `end` as excluded. +/ struct NegInfIntervalRange(TP) if(isTimePoint!TP) @@ -25972,7 +25972,7 @@ public: /++ Params: - rhs = The $(D NegInfIntervalRange) to assign to this one. + rhs = The `NegInfIntervalRange` to assign to this one. +/ ref NegInfIntervalRange opAssign(ref NegInfIntervalRange rhs) pure nothrow { @@ -26006,12 +26006,12 @@ public: /++ - Pops $(D front) from the range, using $(D func) to generate the next + Pops `front` from the range, using `func` to generate the next time point in the range. Throws: $(LREF DateTimeException) if the generated time point is greater than - $(D front). + `front`. +/ void popFront() { @@ -26024,7 +26024,7 @@ public: /++ - Returns a copy of $(D this). + Returns a copy of `this`. +/ @property NegInfIntervalRange save() pure nothrow { @@ -26235,7 +26235,7 @@ public: /++ The name of the time zone per the TZ Database. This is the name used to - get a $(LREF2 .TimeZone, TimeZone) by name with $(D TimeZone.getTimeZone). + get a $(LREF2 .TimeZone, TimeZone) by name with `TimeZone.getTimeZone`. See_Also: $(WEB en.wikipedia.org/wiki/Tz_database, Wikipedia entry on TZ @@ -26278,7 +26278,7 @@ public: /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current dates - but will still return true for $(D hasDST) because the time zone did at + but will still return true for `hasDST` because the time zone did at some point have DST. +/ @property abstract bool hasDST() @safe const nothrow; @@ -26337,13 +26337,13 @@ public: This returns a $(LREF PosixTimeZone) on Posix systems and a $(LREF WindowsTimeZone) on Windows systems. For - $(LREF PosixTimeZone) on Windows, call $(D PosixTimeZone.getTimeZone) + $(LREF PosixTimeZone) on Windows, call `PosixTimeZone.getTimeZone` directly and give it the location of the TZ Database time zone files on disk. On Windows, the given TZ Database name is converted to the corresponding time zone name on Windows prior to calling - $(D WindowsTimeZone.getTimeZone). This function allows for + `WindowsTimeZone.getTimeZone`. This function allows for the same time zone names on both Windows and Posix systems. See_Also: @@ -26701,14 +26701,14 @@ auto tz = TimeZone.getTimeZone("America/Los_Angeles"); On Windows, this function will convert the Windows time zone names to the corresponding TZ Database names with - $(D windowsTZNameToTZDatabaseName). To get the actual Windows time - zone names, use $(D WindowsTimeZone.getInstalledTZNames) directly. + `windowsTZNameToTZDatabaseName`. To get the actual Windows time + zone names, use `WindowsTimeZone.getInstalledTZNames` directly. Params: subName = The first part of the time zones desired. Throws: - $(D FileException) on Posix systems if it fails to read from disk. + `FileException` on Posix systems if it fails to read from disk. $(LREF DateTimeException) on Windows systems if it fails to read the registry. +/ @@ -26813,11 +26813,11 @@ public: { /++ The name of the time zone per the TZ Database. This is the name used to - get a $(LREF2 .TimeZone, TimeZone) by name with $(D TimeZone.getTimeZone). + get a $(LREF2 .TimeZone, TimeZone) by name with `TimeZone.getTimeZone`. Note that this always returns the empty string. This is because time zones cannot be uniquely identified by the attributes given by the - OS (such as the $(D stdName) and $(D dstName)), and neither Posix + OS (such as the `stdName` and `dstName`), and neither Posix systems nor Windows systems provide an easy way to get the TZ Database name of the local time zone. @@ -26976,7 +26976,7 @@ public: /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current - dates but will still return true for $(D hasDST) because the time zone + dates but will still return true for `hasDST` because the time zone did at some point have DST. +/ @property override bool hasDST() @trusted const nothrow @@ -27093,7 +27093,7 @@ public: time. See_Also: - $(D TimeZone.utcToTZ) + `TimeZone.utcToTZ` +/ override long utcToTZ(long stdTime) @trusted const nothrow { @@ -27129,7 +27129,7 @@ public: time to UTC from the appropriate time zone. See_Also: - $(D TimeZone.tzToUTC) + `TimeZone.tzToUTC` Params: adjTime = The time in this time zone that needs to be adjusted to @@ -27361,7 +27361,7 @@ final class UTC : TimeZone public: /++ - $(D UTC) is a singleton class. $(D UTC) returns its only instance. + `UTC` is a singleton class. `UTC` returns its only instance. +/ static immutable(UTC) opCall() @safe pure nothrow { @@ -27395,7 +27395,7 @@ public: time. See_Also: - $(D TimeZone.utcToTZ) + `TimeZone.utcToTZ` +/ override long utcToTZ(long stdTime) @safe const nothrow { @@ -27423,7 +27423,7 @@ public: Returns the given hnsecs without changing them at all. See_Also: - $(D TimeZone.tzToUTC) + `TimeZone.tzToUTC` Params: adjTime = The time in this time zone that needs to be adjusted to @@ -27481,9 +27481,9 @@ private: UTC but no DST. It's primarily used as the time zone in the result of $(LREF SysTime)'s - $(D fromISOString), $(D fromISOExtString), and $(D fromSimpleString). + `fromISOString`, `fromISOExtString`, and `fromSimpleString`. - $(D name) and $(D dstName) are always the empty string since this time zone + `name` and `dstName` are always the empty string since this time zone has no DST, and while it may be meant to represent a time zone which is in the TZ Database, obviously it's not likely to be following the exact rules of any of the time zones in the TZ Database, so it makes no sense to set it. @@ -27583,7 +27583,7 @@ public: Params: utcOffset = This time zone's offset from UTC with west of UTC being negative (it is added to UTC to get the adjusted time). - stdName = The $(D stdName) for this time zone. + stdName = The `stdName` for this time zone. +/ this(Duration utcOffset, string stdName = "") @safe immutable pure { @@ -27602,7 +27602,7 @@ public: Params: utcOffset = This time zone's offset from UTC in minutes with west of negative (it is added to UTC to get the adjusted time). - stdName = The $(D stdName) for this time zone. + stdName = The `stdName` for this time zone. +/ deprecated("Please use the overload which takes a Duration.") this(int utcOffset, string stdName = "") @safe immutable pure @@ -27868,13 +27868,13 @@ private: Represents a time zone from a TZ Database time zone file. Files from the TZ Database are how Posix systems hold their time zone information. Unfortunately, Windows does not use the TZ Database. To use the TZ Database, - use $(D PosixTimeZone) (which reads its information from the TZ Database + use `PosixTimeZone` (which reads its information from the TZ Database files on disk) on Windows by providing the TZ Database files and telling - $(D PosixTimeZone.getTimeZone) where the directory holding them is. + `PosixTimeZone.getTimeZone` where the directory holding them is. - To get a $(D PosixTimeZone), either call $(D PosixTimeZone.getTimeZone) + To get a `PosixTimeZone`, either call `PosixTimeZone.getTimeZone` (which allows specifying the location the time zone files) or call - $(D TimeZone.getTimeZone) (which will give a $(D PosixTimeZone) on Posix + `TimeZone.getTimeZone` (which will give a `PosixTimeZone` on Posix systems and a $(LREF WindowsTimeZone) on Windows systems). Note: @@ -27905,7 +27905,7 @@ public: /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for current - dates but will still return true for $(D hasDST) because the time zone + dates but will still return true for `hasDST` because the time zone did at some point have DST. +/ @property override bool hasDST() @safe const nothrow @@ -28048,7 +28048,7 @@ public: Throws: $(LREF DateTimeException) if the given time zone could not be found or - $(D FileException) if the TZ Database file could not be opened. + `FileException` if the TZ Database file could not be opened. Examples: -------------------- @@ -28377,7 +28377,7 @@ assert(tz.dstName == "PDT"); located. Throws: - $(D FileException) if it fails to read from disk. + `FileException` if it fails to read from disk. +/ static string[] getInstalledTZNames(string subName = "", string tzDatabaseDir = defaultTZDatabaseDir) @trusted { @@ -28459,7 +28459,7 @@ private: /+ Holds information on when a time transition occures (usually a - transition to or from DST) as well as a pointer to the $(D TTInfo) which + transition to or from DST) as well as a pointer to the `TTInfo` which holds information on the utc offset past the transition. +/ struct Transition @@ -28510,7 +28510,7 @@ private: /+ - Struct used to hold information relating to $(D TTInfo) while organizing + Struct used to hold information relating to `TTInfo` while organizing the time zone information prior to putting it in its final form. +/ struct TempTTInfo @@ -28529,7 +28529,7 @@ private: /+ - Struct used to hold information relating to $(D Transition) while + Struct used to hold information relating to `Transition` while organizing the time zone information prior to putting it in its final form. +/ @@ -28549,8 +28549,8 @@ private: /+ - Struct used to hold information relating to $(D Transition) and - $(D TTInfo) while organizing the time zone information prior to putting + Struct used to hold information relating to `Transition` and + `TTInfo` while organizing the time zone information prior to putting it in its final form. +/ struct TransitionType @@ -28600,7 +28600,7 @@ private: /+ - Reads a $(D TempTTInfo) from a TZ file. + Reads a `TempTTInfo` from a TZ file. +/ static T readVal(T)(ref File tzFile) @safe if(is(T == TempTTInfo)) @@ -28613,7 +28613,7 @@ private: /+ Throws: - $(LREF DateTimeException) if $(D result) is false. + $(LREF DateTimeException) if `result` is false. +/ static void _enforceValidTZFile(bool result, size_t line = __LINE__) @safe pure { @@ -28692,7 +28692,7 @@ version(StdDdoc) does not use the TZ Database. To use the TZ Database, use $(LREF PosixTimeZone) (which reads its information from the TZ Database files on disk) on Windows by providing the TZ Database files and telling - $(D PosixTimeZone.getTimeZone) where the directory holding them is. + `PosixTimeZone.getTimeZone` where the directory holding them is. The TZ Database files and Windows' time zone information frequently do not match. Windows has many errors with regards to when DST switches @@ -28707,7 +28707,7 @@ version(StdDdoc) $(LREF WindowsTimeZone) does not exist on Posix systems. To get a $(LREF WindowsTimeZone), either call - $(D WindowsTimeZone.getTimeZone) or call $(D TimeZone.getTimeZone) + `WindowsTimeZone.getTimeZone` or call `TimeZone.getTimeZone` (which will give a $(LREF PosixTimeZone) on Posix systems and a $(LREF WindowsTimeZone) on Windows systems). @@ -28721,7 +28721,7 @@ version(StdDdoc) /++ Whether this time zone has Daylight Savings Time at any point in time. Note that for some time zone types it may not have DST for - current dates but will still return true for $(D hasDST) because the + current dates but will still return true for `hasDST` because the time zone did at some point have DST. +/ @property override bool hasDST() @safe const nothrow; @@ -28793,7 +28793,7 @@ version(StdDdoc) Returns a list of the names of the time zones installed on the system. The list returned by WindowsTimeZone contains the Windows TZ names, not the TZ Database names. However, - $(D TimeZone.getinstalledTZNames) will return the TZ Database names + `TimeZone.getinstalledTZNames` will return the TZ Database names which are equivalent to the Windows TZ names. +/ static string[] getInstalledTZNames() @safe; @@ -29806,17 +29806,17 @@ version(Windows) unittest //============================================================================== /++ - $(D StopWatch) measures time as precisely as possible. + `StopWatch` measures time as precisely as possible. This class uses a high-performance counter. On Windows systems, it uses - $(D QueryPerformanceCounter), and on Posix systems, it uses - $(D clock_gettime) if available, and $(D gettimeofday) otherwise. + `QueryPerformanceCounter`, and on Posix systems, it uses + $(D clock_gettime) if available, and `gettimeofday` otherwise. - But the precision of $(D StopWatch) differs from system to system. It is + But the precision of `StopWatch` differs from system to system. It is impossible to for it to be the same from system to system since the precision of the system clock varies from system to system, and other system-dependent and situation-dependent stuff (such as the overhead of a context switch - between threads) can also affect $(D StopWatch)'s accuracy. + between threads) can also affect `StopWatch`'s accuracy. Examples: -------------------- @@ -30089,9 +30089,9 @@ private: Returns: The amount of time (as a $(CXREF time, TickDuration)) that it took to - call each function $(D n) times. The first value is the length of time - that it took to call $(D fun[0]) $(D n) times. The second value is the - length of time it took to call $(D fun[1]) $(D n) times. Etc. + call each function `n` times. The first value is the length of time + that it took to call `fun[0]` `n` times. The second value is the + length of time it took to call `fun[1]` `n` times. Etc. Note that casting the TickDurations to $(CXREF time, Duration)s will make the results easier to deal with (and it may change in the future that @@ -30363,7 +30363,7 @@ unittest for those who need it. If on Windows and using the standard C functions or Win32 API functions which take a $(D time_t), check whether the return value of - $(D stdTimeToUnixTime) is non-negative. + `stdTimeToUnixTime` is non-negative. Params: stdTime = The std time to convert. @@ -30413,19 +30413,19 @@ version(StdDdoc) /++ $(BLUE This function is Windows-Only.) - Converts a $(D SYSTEMTIME) struct to a $(LREF SysTime). + Converts a `SYSTEMTIME` struct to a $(LREF SysTime). Params: - st = The $(D SYSTEMTIME) struct to convert. - tz = The time zone that the time in the $(D SYSTEMTIME) struct is - assumed to be (if the $(D SYSTEMTIME) was supplied by a Windows - system call, the $(D SYSTEMTIME) will either be in local time + st = The `SYSTEMTIME` struct to convert. + tz = The time zone that the time in the `SYSTEMTIME` struct is + assumed to be (if the `SYSTEMTIME` was supplied by a Windows + system call, the `SYSTEMTIME` will either be in local time or UTC, depending on the call). Throws: - $(LREF DateTimeException) if the given $(D SYSTEMTIME) will not fit in + $(LREF DateTimeException) if the given `SYSTEMTIME` will not fit in a $(LREF SysTime), which is highly unlikely to happen given that - $(D SysTime.max) is in 29,228 A.D. and the maximum $(D SYSTEMTIME) + `SysTime.max` is in 29,228 A.D. and the maximum `SYSTEMTIME` is in 30,827 A.D. +/ SysTime SYSTEMTIMEToSysTime(const SYSTEMTIME* st, immutable TimeZone tz = LocalTime()) @safe; @@ -30434,10 +30434,10 @@ version(StdDdoc) /++ $(BLUE This function is Windows-Only.) - Converts a $(LREF SysTime) to a $(D SYSTEMTIME) struct. + Converts a $(LREF SysTime) to a `SYSTEMTIME` struct. - The $(D SYSTEMTIME) which is returned will be set using the given - $(LREF SysTime)'s time zone, so to get the $(D SYSTEMTIME) in + The `SYSTEMTIME` which is returned will be set using the given + $(LREF SysTime)'s time zone, so to get the `SYSTEMTIME` in UTC, set the $(LREF SysTime)'s time zone to UTC. Params: @@ -30445,7 +30445,7 @@ version(StdDdoc) Throws: $(LREF DateTimeException) if the given $(LREF SysTime) will not fit in a - $(D SYSTEMTIME). This will only happen if the $(LREF SysTime)'s date is + `SYSTEMTIME`. This will only happen if the $(LREF SysTime)'s date is prior to 1601 A.D. +/ SYSTEMTIME SysTimeToSYSTEMTIME(in SysTime sysTime) @safe; @@ -30454,14 +30454,14 @@ version(StdDdoc) /++ $(BLUE This function is Windows-Only.) - Converts a $(D FILETIME) struct to the number of hnsecs since midnight, + Converts a `FILETIME` struct to the number of hnsecs since midnight, January 1st, 1 A.D. Params: - ft = The $(D FILETIME) struct to convert. + ft = The `FILETIME` struct to convert. Throws: - $(LREF DateTimeException) if the given $(D FILETIME) cannot be + $(LREF DateTimeException) if the given `FILETIME` cannot be represented as the return value. +/ long FILETIMEToStdTime(const FILETIME* ft) @safe; @@ -30470,15 +30470,15 @@ version(StdDdoc) /++ $(BLUE This function is Windows-Only.) - Converts a $(D FILETIME) struct to a $(LREF SysTime). + Converts a `FILETIME` struct to a $(LREF SysTime). Params: - ft = The $(D FILETIME) struct to convert. - tz = The time zone that the $(LREF SysTime) will be in ($(D FILETIME)s + ft = The `FILETIME` struct to convert. + tz = The time zone that the $(LREF SysTime) will be in (`FILETIME`s are in UTC). Throws: - $(LREF DateTimeException) if the given $(D FILETIME) will not fit in a + $(LREF DateTimeException) if the given `FILETIME` will not fit in a $(LREF SysTime). +/ SysTime FILETIMEToSysTime(const FILETIME* ft, immutable TimeZone tz = LocalTime()) @safe; @@ -30488,14 +30488,14 @@ version(StdDdoc) $(BLUE This function is Windows-Only.) Converts a number of hnsecs since midnight, January 1st, 1 A.D. to a - $(D FILETIME) struct. + `FILETIME` struct. Params: stdTime = The number of hnsecs since midnight, January 1st, 1 A.D. UTC. Throws: $(LREF DateTimeException) if the given value will not fit in a - $(D FILETIME). + `FILETIME`. +/ FILETIME stdTimeToFILETIME(long stdTime) @safe; @@ -30503,16 +30503,16 @@ version(StdDdoc) /++ $(BLUE This function is Windows-Only.) - Converts a $(LREF SysTime) to a $(D FILETIME) struct. + Converts a $(LREF SysTime) to a `FILETIME` struct. - $(D FILETIME)s are always in UTC. + `FILETIME`s are always in UTC. Params: sysTime = The $(LREF SysTime) to convert. Throws: $(LREF DateTimeException) if the given $(LREF SysTime) will not fit in a - $(D FILETIME). + `FILETIME`. +/ FILETIME SysTimeToFILETIME(SysTime sysTime) @safe; } @@ -30704,7 +30704,7 @@ alias uint DosFileTime; tz = The time zone which the DOS file time is assumed to be in. Throws: - $(LREF DateTimeException) if the $(D DosFileTime) is invalid. + $(LREF DateTimeException) if the `DosFileTime` is invalid. +/ SysTime DosFileTimeToSysTime(DosFileTime dft, immutable TimeZone tz = LocalTime()) @safe { @@ -30747,7 +30747,7 @@ unittest Throws: $(LREF DateTimeException) if the given $(LREF SysTime) cannot be converted to - a $(D DosFileTime). + a `DosFileTime`. +/ DosFileTime SysTimeToDosFileTime(SysTime sysTime) @safe { @@ -30784,8 +30784,8 @@ unittest /++ - The given array of $(D char) or random-access range of $(D char) or - $(D ubyte) is expected to be in the format specified in + The given array of `char` or random-access range of `char` or + `ubyte` is expected to be in the format specified in $(WEB tools.ietf.org/html/rfc5322, RFC 5322) section 3.3 with the grammar rule $(I date-time). It is the date-time format commonly used in internet messages such as e-mail and HTTP. The corresponding @@ -30800,9 +30800,9 @@ unittest of the given date (though it is technically invalid per the spec if the day of the week doesn't match the actual day of the week of the given date). - If the time zone is $(D "-0000") (or considered to be equivalent to - $(D "-0000") by section 4.3 of the spec), a $(LREF SimpleTimeZone) with a - utc offset of $(D 0) is used rather than $(LREF UTC), whereas $(D "+0000") + If the time zone is `"-0000"` (or considered to be equivalent to + `"-0000"` by section 4.3 of the spec), a $(LREF SimpleTimeZone) with a + utc offset of `0` is used rather than $(LREF UTC), whereas `"+0000"` uses $(LREF UTC). Note that because $(LREF SysTime) does not currently support having a second @@ -30810,7 +30810,7 @@ unittest does have a value of 60 for the seconds, it is treated as 59. The one area in which this function violates RFC 5322 is that it accepts - $(D "\n") in folding whitespace in the place of $(D "\r\n"), because the + `"\n"` in folding whitespace in the place of `"\r\n"`, because the HTTP spec requires it. Throws: @@ -31545,7 +31545,7 @@ unittest /++ Whether all of the given strings are valid units of time. - $(D "nsecs") is not considered a valid unit of time. Nothing in std.datetime + `"nsecs"` is not considered a valid unit of time. Nothing in std.datetime can handle precision greater than hnsecs, and the few functions in core.time which deal with "nsecs" deal with it explicitly. +/ @@ -31563,8 +31563,8 @@ bool validTimeUnits(string[] units...) @safe pure nothrow /++ - Compares two time unit strings. $(D "years") are the largest units and - $(D "hnsecs") are the smallest. + Compares two time unit strings. `"years"` are the largest units and + `"hnsecs"` are the smallest. Returns: $(BOOKTABLE, @@ -31617,11 +31617,11 @@ unittest /++ - Compares two time unit strings at compile time. $(D "years") are the largest - units and $(D "hnsecs") are the smallest. + Compares two time unit strings at compile time. `"years"` are the largest + units and `"hnsecs"` are the smallest. - This template is used instead of $(D cmpTimeUnits) because exceptions - can't be thrown at compile time and $(D cmpTimeUnits) must enforce that + This template is used instead of `cmpTimeUnits` because exceptions + can't be thrown at compile time and `cmpTimeUnits` must enforce that the strings it's given are valid time unit strings. This template uses a template constraint instead. @@ -31640,7 +31640,7 @@ template CmpTimeUnits(string lhs, string rhs) /+ - Helper function for $(D CmpTimeUnits). + Helper function for `CmpTimeUnits`. +/ private int cmpTimeUnitsCTFE(string lhs, string rhs) @safe pure nothrow { @@ -31745,7 +31745,7 @@ bool valid(string units)(int year, int month, int day) @safe pure nothrow thrown. Throws: - $(LREF DateTimeException) if $(D valid!units(value)) is false. + $(LREF DateTimeException) if `valid!units(value)` is false. +/ void enforceValid(string units)(int value, string file = __FILE__, size_t line = __LINE__) @safe pure if(units == "months" || @@ -31965,7 +31965,7 @@ version(StdDdoc) and stopping it when its return value goes out of scope and is destroyed. When the value that is returned by this function is destroyed, - $(D func) will run. $(D func) is a unary function that takes a + `func` will run. `func` is a unary function that takes a $(CXREF time, TickDuration). Examples: @@ -32704,7 +32704,7 @@ unittest /+ Strips what RFC 5322, section 3.2.2 refers to as CFWS from the left-hand side of the given range (it strips comments delimited by $(D '(') and - $(D ')') as well as folding whitespace). + `'`') as well as folding whitespace). It is assumed that the given range contains the value of a header field and no terminating CRLF for the line (though the CRLF for folding whitespace is diff --git a/std/digest/crc.d b/std/digest/crc.d index e92ff83af80..ac917c437f6 100644 --- a/std/digest/crc.d +++ b/std/digest/crc.d @@ -18,10 +18,10 @@ $(TR $(TDNW Helpers) $(TD $(MYREF crcHexString) $(MYREF crc32Of)) ) * - * This module conforms to the APIs defined in $(D std.digest.digest). To understand the - * differences between the template and the OOP API, see $(D std.digest.digest). + * This module conforms to the APIs defined in `std.digest.digest`. To understand the + * differences between the template and the OOP API, see `std.digest.digest`. * - * This module publicly imports $(D std.digest.digest) and can be used as a stand-alone + * This module publicly imports `std.digest.digest` and can be used as a stand-alone * module. * * Note: @@ -145,7 +145,7 @@ private immutable uint[256] crc32_table = /** * Template API CRC32 implementation. - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. */ struct CRC32 { @@ -156,8 +156,8 @@ struct CRC32 public: /** * Use this to feed the digest with data. - * Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and - * $(D const(ubyte)[]). + * Also implements the $(XREF range, OutputRange) interface for `ubyte` and + * `const(ubyte)[]`. */ void put(scope const(ubyte)[] data...) @trusted pure nothrow @nogc { @@ -215,7 +215,7 @@ struct CRC32 } /** - * Works like $(D finish) but does not reset the internal state, so it's possible + * Works like `finish` but does not reset the internal state, so it's possible * to continue putting data into this CRC32 after a call to peek. */ ubyte[4] peek() const @safe pure nothrow @nogc @@ -332,7 +332,7 @@ unittest /** * OOP API CRC32 implementation. - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. * * This is an alias for $(XREF digest.digest, WrapperDigest)!CRC32, see * $(XREF digest.digest, WrapperDigest) for more information. diff --git a/std/digest/digest.d b/std/digest/digest.d index 2f9522bad92..0faf34b20d3 100644 --- a/std/digest/digest.d +++ b/std/digest/digest.d @@ -26,13 +26,13 @@ $(TR $(TDNW Implementation helpers) $(TD $(MYREF digestLength) $(MYREF WrapperDi * There are two APIs for digests: The template API and the OOP API. The template API uses structs * and template helpers like $(LREF isDigest). The OOP API implements digests as classes inheriting * the $(LREF Digest) interface. All digests are named so that the template API struct is called "$(B x)" - * and the OOP API class is called "$(B x)Digest". For example we have $(D MD5) <--> $(D MD5Digest), - * $(D CRC32) <--> $(D CRC32Digest), etc. + * and the OOP API class is called "$(B x)Digest". For example we have `MD5` <--> `MD5Digest`, + * `CRC32` <--> `CRC32Digest`, etc. * * The template API is slightly more efficient. It does not have to allocate memory dynamically, * all memory is allocated on the stack. The OOP API has to allocate in the finish method if no * buffer was provided. If you provide a buffer to the OOP APIs finish function, it doesn't allocate, - * but the $(LREF Digest) classes still have to be created using $(D new) which allocates them using the GC. + * but the $(LREF Digest) classes still have to be created using `new` which allocates them using the GC. * * The OOP API is useful to change the _digest function and/or _digest backend at 'runtime'. The benefit here * is that switching e.g. Phobos MD5Digest and an OpenSSLMD5Digest implementation is ABI compatible. @@ -49,7 +49,7 @@ $(TR $(TDNW Implementation helpers) $(TD $(MYREF digestLength) $(MYREF WrapperDi * * Macros: * MYREF2 = $1  - * MYREF3 = $(D $1) + * MYREF3 = `$1` * * CTFE: * Digests do not work in CTFE @@ -198,7 +198,7 @@ version(ExampleDigest) * Note: * $(UL * $(LI A digest must be a struct (value type) to pass the $(LREF isDigest) test.) - * $(LI A digest passing the $(LREF isDigest) test is always an $(D OutputRange)) + * $(LI A digest passing the $(LREF isDigest) test is always an `OutputRange`) * ) */ struct ExampleDigest @@ -206,9 +206,9 @@ version(ExampleDigest) public: /** * Use this to feed the digest with data. - * Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and - * $(D const(ubyte)[]). - * The following usages of $(D put) must work for any type which passes $(LREF isDigest): + * Also implements the $(XREF range, OutputRange) interface for `ubyte` and + * `const(ubyte)[]`. + * The following usages of `put` must work for any type which passes $(LREF isDigest): * Examples: * ---- * ExampleDigest dig; @@ -238,7 +238,7 @@ version(ExampleDigest) * * Note: * The actual type returned by finish depends on the digest implementation. - * $(D ubyte[16]) is just used as an example. It is guaranteed that the type is a + * `ubyte[16]` is just used as an example. It is guaranteed that the type is a * static array of ubytes. * * $(UL @@ -347,7 +347,7 @@ unittest } /** - * Used to check if a digest supports the $(D peek) method. + * Used to check if a digest supports the `peek` method. * Peek has exactly the same function signatures as finish, but it doesn't reset * the digest's internal state. * @@ -404,7 +404,7 @@ private template isDigestibleRange(Range) * Every digest passing the $(LREF isDigest) test can be used with this function. * * Params: - * range= an $(D InputRange) with $(D ElementType) $(D ubyte), $(D ubyte[]) or $(D ubyte[num]) + * range= an `InputRange` with `ElementType` `ubyte`, `ubyte[]` or `ubyte[num]` */ DigestType!Hash digest(Hash, Range)(auto ref Range range) if(!isArray!Range && isDigestibleRange!Range) @@ -465,7 +465,7 @@ unittest * * Params: * order= the order in which the bytes are processed (see $(LREF toHexString)) - * range= an $(D InputRange) with $(D ElementType) $(D ubyte), $(D ubyte[]) or $(D ubyte[num]) + * range= an `InputRange` with `ElementType` `ubyte`, `ubyte[]` or `ubyte[num]` */ char[digestLength!(Hash)*2] hexDigest(Hash, Order order = Order.increasing, Range)(ref Range range) if(!isArray!Range && isDigestibleRange!Range) @@ -537,15 +537,15 @@ unittest * The Digest interface is the base interface which is implemented by all digests. * * Note: - * A Digest implementation is always an $(D OutputRange) + * A Digest implementation is always an `OutputRange` */ interface Digest { public: /** * Use this to feed the digest with data. - * Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and - * $(D const(ubyte)[]). + * Also implements the $(XREF range, OutputRange) interface for `ubyte` and + * `const(ubyte)[]`. * * Examples: * ---- @@ -564,7 +564,7 @@ interface Digest * Resets the internal state of the digest. * Note: * $(LREF finish) calls this internally, so it's not necessary to call - * $(D reset) manually after a call to $(LREF finish). + * `reset` manually after a call to $(LREF finish). */ @trusted nothrow void reset(); @@ -841,8 +841,8 @@ class WrapperDigest(T) if(isDigest!T) : Digest /** * Use this to feed the digest with data. - * Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and - * $(D const(ubyte)[]). + * Also implements the $(XREF range, OutputRange) interface for `ubyte` and + * `const(ubyte)[]`. */ @trusted nothrow void put(scope const(ubyte)[] data...) { @@ -853,7 +853,7 @@ class WrapperDigest(T) if(isDigest!T) : Digest * Resets the internal state of the digest. * Note: * $(LREF finish) calls this internally, so it's not necessary to call - * $(D reset) manually after a call to $(LREF finish). + * `reset` manually after a call to $(LREF finish). */ @trusted nothrow void reset() { @@ -911,10 +911,10 @@ class WrapperDigest(T) if(isDigest!T) : Digest version(StdDdoc) { /** - * Works like $(D finish) but does not reset the internal state, so it's possible + * Works like `finish` but does not reset the internal state, so it's possible * to continue putting data into this WrapperDigest after a call to peek. * - * These functions are only available if $(D hasPeek!T) is true. + * These functions are only available if `hasPeek!T` is true. */ @trusted ubyte[] peek(scope ubyte[] buf) const; ///ditto diff --git a/std/digest/md.d b/std/digest/md.d index 853d9ed00ff..8c3f0ac9f72 100644 --- a/std/digest/md.d +++ b/std/digest/md.d @@ -18,10 +18,10 @@ $(TR $(TDNW Helpers) $(TD $(MYREF md5Of)) ) ) - * This module conforms to the APIs defined in $(D std.digest.digest). To understand the - * differences between the template and the OOP API, see $(D std.digest.digest). + * This module conforms to the APIs defined in `std.digest.digest`. To understand the + * differences between the template and the OOP API, see `std.digest.digest`. * - * This module publicly imports $(D std.digest.digest) and can be used as a stand-alone + * This module publicly imports `std.digest.digest` and can be used as a stand-alone * module. * * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). @@ -93,7 +93,7 @@ private uint rotateLeft(uint x, uint n) @safe pure nothrow @nogc /** * Template API MD5 implementation. - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. */ struct MD5 { @@ -286,8 +286,8 @@ struct MD5 public: /** * Use this to feed the digest with data. - * Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and - * $(D const(ubyte)[]). + * Also implements the $(XREF range, OutputRange) interface for `ubyte` and + * `const(ubyte)[]`. * * Examples: * ---- @@ -508,7 +508,7 @@ unittest /** * OOP API MD5 implementation. - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. * * This is an alias for $(XREF digest.digest, WrapperDigest)!MD5, see * $(XREF digest.digest, WrapperDigest) for more information. diff --git a/std/digest/ripemd.d b/std/digest/ripemd.d index 52a26053bb4..e81433f1881 100644 --- a/std/digest/ripemd.d +++ b/std/digest/ripemd.d @@ -18,10 +18,10 @@ $(TR $(TDNW Helpers) $(TD $(MYREF ripemd160Of)) ) ) - * This module conforms to the APIs defined in $(D std.digest.digest). To understand the - * differences between the template and the OOP API, see $(D std.digest.digest). + * This module conforms to the APIs defined in `std.digest.digest`. To understand the + * differences between the template and the OOP API, see `std.digest.digest`. * - * This module publicly imports $(D std.digest.digest) and can be used as a stand-alone + * This module publicly imports `std.digest.digest` and can be used as a stand-alone * module. * * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). @@ -97,7 +97,7 @@ private uint rotateLeft(uint x, uint n) @safe pure nothrow @nogc /** * Template API RIPEMD160 implementation. - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. */ struct RIPEMD160 { @@ -442,8 +442,8 @@ struct RIPEMD160 public: /** * Use this to feed the digest with data. - * Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and - * $(D const(ubyte)[]). + * Also implements the $(XREF range, OutputRange) interface for `ubyte` and + * `const(ubyte)[]`. * * Examples: * ---- @@ -677,7 +677,7 @@ unittest /** * OOP API RIPEMD160 implementation. - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. * * This is an alias for $(XREF digest.digest, WrapperDigest)!RIPEMD160, see * $(XREF digest.digest, WrapperDigest) for more information. diff --git a/std/digest/sha.d b/std/digest/sha.d index 8b3137bfa13..6af2a137f1e 100644 --- a/std/digest/sha.d +++ b/std/digest/sha.d @@ -23,10 +23,10 @@ $(TR $(TDNW Helpers) $(TD $(MYREF sha1Of)) * SHA2 comes in several different versions, all supported by this module: * SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256. * - * This module conforms to the APIs defined in $(D std.digest.digest). To understand the - * differences between the template and the OOP API, see $(D std.digest.digest). + * This module conforms to the APIs defined in `std.digest.digest`. To understand the + * differences between the template and the OOP API, see `std.digest.digest`. * - * This module publicly imports $(D std.digest.digest) and can be used as a stand-alone + * This module publicly imports `std.digest.digest` and can be used as a stand-alone * module. * * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). @@ -200,7 +200,7 @@ private ulong rotateRight(ulong x, uint n) @safe pure nothrow @nogc * simply use the convenience aliases: SHA1, SHA224, SHA256, SHA384, SHA512, * SHA512_224 and SHA512_256. * - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. */ struct SHA(int blockSize, int digestSize) { @@ -688,8 +688,8 @@ struct SHA(int blockSize, int digestSize) /** * Use this to feed the digest with data. - * Also implements the $(XREF range, OutputRange) interface for $(D ubyte) and - * $(D const(ubyte)[]). + * Also implements the $(XREF range, OutputRange) interface for `ubyte` and + * `const(ubyte)[]`. */ void put(scope const(ubyte)[] input...) @trusted pure nothrow @nogc { @@ -1170,7 +1170,7 @@ unittest /** * OOP API SHA1 and SHA2 implementations. - * See $(D std.digest.digest) for differences between template and OOP API. + * See `std.digest.digest` for differences between template and OOP API. * * This is an alias for $(XREF digest.digest, WrapperDigest)!SHA1, see * $(XREF digest.digest, WrapperDigest) for more information. diff --git a/std/encoding.d b/std/encoding.d index 9e65ad74c56..66dfa32c74f 100644 --- a/std/encoding.d +++ b/std/encoding.d @@ -11,15 +11,15 @@ Encodings currently supported are UTF-8, UTF-16, UTF-32, ASCII, ISO-8859-1 (also known as LATIN-1), and WINDOWS-1252. $(UL -$(LI The type $(D AsciiChar) represents an ASCII character.) -$(LI The type $(D AsciiString) represents an ASCII string.) -$(LI The type $(D Latin1Char) represents an ISO-8859-1 character.) -$(LI The type $(D Latin1String) represents an ISO-8859-1 string.) -$(LI The type $(D Windows1252Char) represents a Windows-1252 character.) -$(LI The type $(D Windows1252String) represents a Windows-1252 string.)) +$(LI The type `AsciiChar` represents an ASCII character.) +$(LI The type `AsciiString` represents an ASCII string.) +$(LI The type `Latin1Char` represents an ISO-8859-1 character.) +$(LI The type `Latin1String` represents an ISO-8859-1 string.) +$(LI The type `Windows1252Char` represents a Windows-1252 character.) +$(LI The type `Windows1252String` represents a Windows-1252 string.)) For cases where the _encoding is not known at compile-time, but is -known at run-time, we provide the abstract class $(D EncodingScheme) +known at run-time, we provide the abstract class `EncodingScheme` and its subclasses. To construct a run-time encoder/decoder, one does e.g. @@ -27,7 +27,7 @@ e.g. auto e = EncodingScheme.create("utf-8"); ---------------------------------------------------- -This library supplies $(D EncodingScheme) subclasses for ASCII, +This library supplies `EncodingScheme` subclasses for ASCII, ISO-8859-1 (also known as LATIN-1), WINDOWS-1252, UTF-8, and (on little-endian architectures) UTF-16LE and UTF-32LE; or (on big-endian architectures) UTF-16BE and UTF-32BE. @@ -359,7 +359,7 @@ unittest //============================================================================= -/** Special value returned by $(D safeDecode) */ +/** Special value returned by `safeDecode` */ enum dchar INVALID_SEQUENCE = cast(dchar) 0xFFFFFFFF; template EncoderFunctions() @@ -1242,7 +1242,7 @@ Returns true if c is a valid code point characters). Supersedes: - This function supersedes $(D std.utf.startsValidDchar()). + This function supersedes `std.utf.startsValidDchar()`. Standards: Unicode 5.0, ASCII, ISO-8859-1, WINDOWS-1252 @@ -1741,8 +1741,8 @@ body // } /* -Encodes $(D c) in units of type $(D E) and writes the result to the -output range $(D R). Returns the number of $(D E)s written. +Encodes `c` in units of type `E` and writes the result to the +output range `R`. Returns the number of `E`s written. */ size_t encode(E, R)(dchar c, auto ref R range) if (isNativeOutputRange!(R, E)) @@ -1844,12 +1844,12 @@ body } /** -Encodes the contents of $(D s) in units of type $(D Tgt), writing the result to an +Encodes the contents of `s` in units of type `Tgt`, writing the result to an output range. -Returns: The number of $(D Tgt) elements written. +Returns: The number of `Tgt` elements written. Params: -Tgt = Element type of $(D range). +Tgt = Element type of `range`. s = Input array. range = Output range. */ diff --git a/std/exception.d b/std/exception.d index f3f6407c603..59b125b0095 100644 --- a/std/exception.d +++ b/std/exception.d @@ -52,12 +52,12 @@ import core.stdc.string; /++ Asserts that the given expression does $(I not) throw the given type - of $(D Throwable). If a $(D Throwable) of the given type is thrown, + of `Throwable`. If a `Throwable` of the given type is thrown, it is caught and does not escape assertNotThrown. Rather, an - $(D AssertError) is thrown. However, any other $(D Throwable)s will escape. + `AssertError` is thrown. However, any other `Throwable`s will escape. Params: - T = The $(D Throwable) to test for. + T = The `Throwable` to test for. expression = The expression to test. msg = Optional message to output on test failure. If msg is empty, and the thrown exception has a @@ -69,7 +69,7 @@ import core.stdc.string; Defaults to $(D __LINE__). Throws: - $(D AssertError) if the given $(D Throwable) is thrown. + `AssertError` if the given `Throwable` is thrown. +/ void assertNotThrown(T : Throwable = Exception, E) (lazy E expression, @@ -199,13 +199,13 @@ unittest } /++ - Asserts that the given expression throws the given type of $(D Throwable). - The $(D Throwable) is caught and does not escape assertThrown. However, - any other $(D Throwable)s $(I will) escape, and if no $(D Throwable) - of the given type is thrown, then an $(D AssertError) is thrown. + Asserts that the given expression throws the given type of `Throwable`. + The `Throwable` is caught and does not escape assertThrown. However, + any other `Throwable`s $(I will) escape, and if no `Throwable` + of the given type is thrown, then an `AssertError` is thrown. Params: - T = The $(D Throwable) to test for. + T = The `Throwable` to test for. expression = The expression to test. msg = Optional message to output on test failure. file = The file where the error occurred. @@ -214,7 +214,7 @@ unittest Defaults to $(D __LINE__). Throws: - $(D AssertError) if the given $(D Throwable) is not thrown. + `AssertError` if the given `Throwable` is not thrown. +/ void assertThrown(T : Throwable = Exception, E) (lazy E expression, @@ -327,16 +327,16 @@ unittest /++ - If $(D !!value) is true, $(D value) is returned. Otherwise, + If `!!value` is true, `value` is returned. Otherwise, $(D new Exception(msg)) is thrown. Note: - $(D enforce) is used to throw exceptions and is therefore intended to + `enforce` is used to throw exceptions and is therefore intended to aid in error handling. It is $(I not) intended for verifying the logic - of your program. That is what $(D assert) is for. Also, do not use - $(D enforce) inside of contracts (i.e. inside of $(D in) and $(D out) - blocks and $(D invariant)s), because they will be compiled out when - compiling with $(I -release). Use $(D assert) in contracts. + of your program. That is what `assert` is for. Also, do not use + `enforce` inside of contracts (i.e. inside of `in` and `out` + blocks and `invariant`s), because they will be compiled out when + compiling with $(I -release). Use `assert` in contracts. Example: -------------------- @@ -368,10 +368,10 @@ T enforce(T, string file, size_t line = __LINE__) } /++ - If $(D !!value) is true, $(D value) is returned. Otherwise, the given + If `!!value` is true, `value` is returned. Otherwise, the given delegate is called. - The whole safety and purity are inferred from $(D Dg)'s safety and purity. + The whole safety and purity are inferred from `Dg`'s safety and purity. +/ T enforce(T, Dg, string file = __FILE__, size_t line = __LINE__) (T value, scope Dg dg) @@ -510,7 +510,7 @@ deprecated unittest } /++ - If $(D !!value) is true, $(D value) is returned. Otherwise, $(D ex) is thrown. + If `!!value` is true, `value` is returned. Otherwise, `ex` is thrown. Example: -------------------- @@ -532,9 +532,9 @@ unittest } /++ - If $(D !!value) is true, $(D value) is returned. Otherwise, - $(D new ErrnoException(msg)) is thrown. $(D ErrnoException) assumes that the - last operation set $(D errno) to an error code. + If `!!value` is true, `value` is returned. Otherwise, + $(D new ErrnoException(msg)) is thrown. `ErrnoException` assumes that the + last operation set `errno` to an error code. Example: -------------------- @@ -552,12 +552,12 @@ T errnoEnforce(T, string file = __FILE__, size_t line = __LINE__) /++ - If $(D !!value) is $(D true), $(D value) is returned. Otherwise, - $(D new E(msg, file, line)) is thrown. Or if $(D E) doesn't take a message + If `!!value` is `true`, `value` is returned. Otherwise, + $(D new E(msg, file, line)) is thrown. Or if `E` doesn't take a message and can be constructed with $(D new E(file, line)), then $(D new E(file, line)) will be thrown. - This is legacy name, it is recommended to use $(D enforce!E) instead. + This is legacy name, it is recommended to use `enforce!E` instead. Example: -------------------- @@ -642,14 +642,14 @@ unittest /++ Catches and returns the exception thrown from the given expression. - If no exception is thrown, then null is returned and $(D result) is + If no exception is thrown, then null is returned and `result` is set to the result of the expression. - Note that while $(D collectException) $(I can) be used to collect any - $(D Throwable) and not just $(D Exception)s, it is generally ill-advised to - catch anything that is neither an $(D Exception) nor a type derived from - $(D Exception). So, do not use $(D collectException) to collect - non-$(D Exception)s unless you're sure that that's what you really want to + Note that while `collectException` $(I can) be used to collect any + `Throwable` and not just `Exception`s, it is generally ill-advised to + catch anything that is neither an `Exception` nor a type derived from + `Exception`. So, do not use `collectException` to collect + non-`Exception`s unless you're sure that that's what you really want to do. Params: @@ -683,14 +683,14 @@ unittest /++ Catches and returns the exception thrown from the given expression. - If no exception is thrown, then null is returned. $(D E) can be - $(D void). - - Note that while $(D collectException) $(I can) be used to collect any - $(D Throwable) and not just $(D Exception)s, it is generally ill-advised to - catch anything that is neither an $(D Exception) nor a type derived from - $(D Exception). So, do not use $(D collectException) to collect - non-$(D Exception)s unless you're sure that that's what you really want to + If no exception is thrown, then null is returned. `E` can be + `void`. + + Note that while `collectException` $(I can) be used to collect any + `Throwable` and not just `Exception`s, it is generally ill-advised to + catch anything that is neither an `Exception` nor a type derived from + `Exception`. So, do not use `collectException` to collect + non-`Exception`s unless you're sure that that's what you really want to do. Params: @@ -719,16 +719,16 @@ unittest /++ Catches the exception thrown from the given expression and returns the msg property of that exception. If no exception is thrown, then null is - returned. $(D E) can be $(D void). + returned. `E` can be `void`. If an exception is thrown but it has an empty message, then - $(D emptyExceptionMsg) is returned. + `emptyExceptionMsg` is returned. - Note that while $(D collectExceptionMsg) $(I can) be used to collect any - $(D Throwable) and not just $(D Exception)s, it is generally ill-advised to - catch anything that is neither an $(D Exception) nor a type derived from - $(D Exception). So, do not use $(D collectExceptionMsg) to collect - non-$(D Exception)s unless you're sure that that's what you really want to + Note that while `collectExceptionMsg` $(I can) be used to collect any + `Throwable` and not just `Exception`s, it is generally ill-advised to + catch anything that is neither an `Exception` nor a type derived from + `Exception`. So, do not use `collectExceptionMsg` to collect + non-`Exception`s unless you're sure that that's what you really want to do. Params: @@ -768,18 +768,18 @@ enum emptyExceptionMsg = ""; /** * Casts a mutable array to an immutable array in an idiomatic - * manner. Technically, $(D assumeUnique) just inserts a cast, + * manner. Technically, `assumeUnique` just inserts a cast, * but its name documents assumptions on the part of the - * caller. $(D assumeUnique(arr)) should only be called when + * caller. `assumeUnique(arr)` should only be called when * there are no more active mutable aliases to elements of $(D - * arr). To strengthen this assumption, $(D assumeUnique(arr)) - * also clears $(D arr) before returning. Essentially $(D + * arr). To strengthen this assumption, `assumeUnique(arr)` + * also clears `arr` before returning. Essentially $(D * assumeUnique(arr)) indicates commitment from the caller that there - * is no more mutable access to any of $(D arr)'s elements + * is no more mutable access to any of `arr`'s elements * (transitively), and that all future accesses will be done through - * the immutable array returned by $(D assumeUnique). + * the immutable array returned by `assumeUnique`. * - * Typically, $(D assumeUnique) is used to return arrays from + * Typically, `assumeUnique` is used to return arrays from * functions that have allocated and built them. * * Example: @@ -796,10 +796,10 @@ enum emptyExceptionMsg = ""; * } * ---- * - * The use in the example above is correct because $(D result) - * was private to $(D letters) and is inaccessible in writing + * The use in the example above is correct because `result` + * was private to `letters` and is inaccessible in writing * after the function returns. The following example shows an - * incorrect use of $(D assumeUnique). + * incorrect use of `assumeUnique`. * * Bad: * @@ -820,7 +820,7 @@ enum emptyExceptionMsg = ""; * * The example above wreaks havoc on client code because it is * modifying arrays that callers considered immutable. To obtain an - * immutable array from the writable array $(D buffer), replace + * immutable array from the writable array `buffer`, replace * the last line with: * ---- * return to!(string)(sneaky); // not that sneaky anymore @@ -850,10 +850,10 @@ enum emptyExceptionMsg = ""; * $(WEB archjava.fluid.cs.cmu.edu/papers/oopsla02.pdf, ArchJava) * language. * - * The downside of using $(D assumeUnique)'s + * The downside of using `assumeUnique`'s * convention-based usage is that at this time there is no * formal checking of the correctness of the assumption; - * on the upside, the idiomatic use of $(D assumeUnique) is + * on the upside, the idiomatic use of `assumeUnique` is * simple and rare enough to be tolerable. * */ @@ -892,17 +892,17 @@ version(none) unittest } /** - * Wraps a possibly-throwing expression in a $(D nothrow) wrapper so that it - * can be called by a $(D nothrow) function. + * Wraps a possibly-throwing expression in a `nothrow` wrapper so that it + * can be called by a `nothrow` function. * * This wrapper function documents commitment on the part of the caller that * the appropriate steps have been taken to avoid whatever conditions may - * trigger an exception during the evaluation of $(D expr). If it turns out + * trigger an exception during the evaluation of `expr`. If it turns out * that the expression $(I does) throw at runtime, the wrapper will throw an - * $(D AssertError). + * `AssertError`. * - * (Note that $(D Throwable) objects such as $(D AssertError) that do not - * subclass $(D Exception) may be thrown even from $(D nothrow) functions, + * (Note that `Throwable` objects such as `AssertError` that do not + * subclass `Exception` may be thrown even from `nothrow` functions, * since they are considered to be serious runtime problems that cannot be * recovered from.) */ @@ -967,34 +967,34 @@ unittest } /** -The "pointsTo" functions, $(D doesPointTo) and $(D mayPointTo). +The "pointsTo" functions, `doesPointTo` and `mayPointTo`. -Returns $(D true) if $(D source)'s representation embeds a pointer -that points to $(D target)'s representation or somewhere inside +Returns `true` if `source`'s representation embeds a pointer +that points to `target`'s representation or somewhere inside it. -If $(D source) is or contains a dynamic array, then, then these functions will check -if there is overlap between the dynamic array and $(D target)'s representation. +If `source` is or contains a dynamic array, then, then these functions will check +if there is overlap between the dynamic array and `target`'s representation. -If $(D source) is a class, then pointsTo will handle it as a pointer. +If `source` is a class, then pointsTo will handle it as a pointer. -If $(D target) is a pointer, a dynamic array or a class, then these functions will only -check if $(D source) points to $(D target), $(I not) what $(D target) references. +If `target` is a pointer, a dynamic array or a class, then these functions will only +check if `source` points to `target`, $(I not) what `target` references. -If $(D source) is or contains a union, then there may be either false positives or +If `source` is or contains a union, then there may be either false positives or false negatives: -$(D doesPointTo) will return $(D true) if it is absolutely certain -$(D source) points to $(D target). It may produce false negatives, but never +`doesPointTo` will return `true` if it is absolutely certain +`source` points to `target`. It may produce false negatives, but never false positives. This function should be prefered when trying to validate input data. -$(D mayPointTo) will return $(D false) if it is absolutely certain -$(D source) does not point to $(D target). It may produce false positives, but never +`mayPointTo` will return `false` if it is absolutely certain +`source` does not point to `target`. It may produce false positives, but never false negatives. This function should be prefered for defensively choosing a code path. -Note: Evaluating $(D pointsTo(x, x)) checks whether $(D x) has +Note: Evaluating $(D pointsTo(x, x)) checks whether `x` has internal pointers. This should only be done as an assertive test, as the language is free to assume objects don't have internal pointers (TDPL 7.1.3.5). @@ -1082,7 +1082,7 @@ deprecated ("pointsTo is ambiguous. Please use either of doesPointTo or mayPoint alias pointsTo = doesPointTo; /+ -Returns true if the field at index $(D i) in ($D T) shares its address with another field. +Returns true if the field at index `i` in ($D T) shares its address with another field. Note: This does not merelly check if the field is a member of an union, but also that it is not a single child. @@ -1409,7 +1409,7 @@ unittest //more alias this opCast } /********************* - * Thrown if errors that set $(D errno) occur. + * Thrown if errors that set `errno` occur. */ class ErrnoException : Exception { @@ -1433,12 +1433,12 @@ class ErrnoException : Exception /++ ML-style functional exception handling. Runs the supplied expression and - returns its result. If the expression throws a $(D Throwable), runs the + returns its result. If the expression throws a `Throwable`, runs the supplied error handler instead and return its result. The error handler's type must be the same as the expression's type. Params: - E = The type of $(D Throwable)s to catch. Defaults to $(D Exception) + E = The type of `Throwable`s to catch. Defaults to `Exception` T1 = The type of the expression. T2 = The return type of the error handler. expression = The expression to run and return its result. @@ -1615,8 +1615,8 @@ version(unittest) package cast(void)dg(); } -/** This $(D enum) is used to select the methods of the range to handle by the - $(D handle) range wrapper. The values of the $(D enum) can be OR'd to +/** This `enum` is used to select the methods of the range to handle by the + `handle` range wrapper. The values of the `enum` can be OR'd to selected multiple primitives to be handled. */ enum RangePrimitive @@ -1636,27 +1636,27 @@ enum RangePrimitive /** This range handles exceptions originating in ranges. To use the range the code has to specify what methods of the range should be -handled. This is done by use of the $(LREF $(D RangePrimitive)) enum. Multiple +handled. This is done by use of the $(LREF `RangePrimitive`) enum. Multiple methods of a range can be handled at once, by using the or operator two -combine multiple $(D RangePrimitive). If more than one method should be +combine multiple `RangePrimitive`. If more than one method should be handled by one user supplied handler, all methods must have the same sigature. -The $(D handler) $(D alias) must takes a $(D Throwable) as first of type $(D -R) as first argument a range of type $(D IRange) as second argument. The -return type of the $(D alias) must be equal to the return type of the +The `handler` `alias` must takes a `Throwable` as first of type $(D +R) as first argument a range of type `IRange` as second argument. The +return type of the `alias` must be equal to the return type of the primitive handled. Params: E = The type of Throwable to handle. - functionsToHandle = The $(D RangePrimitive) selecting which primitives to + functionsToHandle = The `RangePrimitive` selecting which primitives to handle. handler = The callable that is called when a handled primitive throw an - $(D Throwable) of type $(D E). The handler must have the same return type + `Throwable` of type `E`. The handler must have the same return type as the handled primitive and must accepect parameters of the $(D E, ref IRange). input = The range to handle. -Returns: A wrapper $(D struct) that preserves the $(D range) interface of the +Returns: A wrapper `struct` that preserves the `range` interface of the passed $(D IRange input). */ auto handle(E : Throwable, RangePrimitive functionsToHandle, alias handler, IRange)(IRange input) diff --git a/std/experimental/logger/core.d b/std/experimental/logger/core.d index e5f71cb384c..b3cf1f3fe88 100644 --- a/std/experimental/logger/core.d +++ b/std/experimental/logger/core.d @@ -20,9 +20,9 @@ shared static this() stdSharedLoggerMutex = new Mutex; } -/** This template evaluates if the passed $(D LogLevel) is active. +/** This template evaluates if the passed `LogLevel` is active. The previously described version statements are used to decide if the -$(D LogLevel) is active. The version statements only influence the compile +`LogLevel` is active. The version statements only influence the compile unit they are used with, therefore this function can only disable logging this specific compile unit. */ @@ -67,10 +67,10 @@ template isLoggingActiveAt(LogLevel ll) } } -/// This compile-time flag is $(D true) if logging is not statically disabled. +/// This compile-time flag is `true` if logging is not statically disabled. enum isLoggingActive = isLoggingActiveAt!(LogLevel.all); -/** This functions is used at runtime to determine if a $(D LogLevel) is +/** This functions is used at runtime to determine if a `LogLevel` is active. The same previously defined version statements are used to disable certain levels. Again the version statements are associated with a compile unit and can therefore not disable logging in other compile units. @@ -106,19 +106,19 @@ bool isLoggingEnabled()(LogLevel ll, LogLevel loggerLL, && condition; } -/** This template returns the $(D LogLevel) named "logLevel" of type $(D +/** This template returns the `LogLevel` named "logLevel" of type $(D LogLevel) defined in a user defined module where the filename has the -suffix "_loggerconfig.d". This $(D LogLevel) sets the minimal $(D LogLevel) +suffix "_loggerconfig.d". This `LogLevel` sets the minimal `LogLevel` of the module. -A minimal $(D LogLevel) can be defined on a per module basis. -In order to define a module $(D LogLevel) a file with a modulename +A minimal `LogLevel` can be defined on a per module basis. +In order to define a module `LogLevel` a file with a modulename "MODULENAME_loggerconfig" must be found. If no such module exists and the module is a nested module, it is checked if there exists a "PARENT_MODULE_loggerconfig" module with such a symbol. -If this module exists and it contains a $(D LogLevel) called logLevel this $(D +If this module exists and it contains a `LogLevel` called logLevel this $(D LogLevel) will be used. This parent lookup is continued until there is no -parent module. Then the moduleLogLevel is $(D LogLevel.all). +parent module. Then the moduleLogLevel is `LogLevel.all`. */ template moduleLogLevel(string moduleName) if (!moduleName.length) { @@ -164,9 +164,9 @@ private string parentOf(string mod) return null; } -/* This function formates a $(D SysTime) into an $(D OutputRange). +/* This function formates a `SysTime` into an `OutputRange`. -The $(D SysTime) is formatted similar to +The `SysTime` is formatted similar to $(LREF std.datatime.DateTime.toISOExtString) expect the fractional second part. The sub second part is the upper three digest of the microsecond. */ @@ -182,13 +182,13 @@ void systimeToISOString(OutputRange)(OutputRange o, const ref SysTime time) /** This function logs data. -In order for the data to be processed the $(D LogLevel) of the log call must -be greater or equal to the $(D LogLevel) of the $(D sharedLog) and the -$(D defaultLogLevel) additionally the condition passed must be $(D true). +In order for the data to be processed the `LogLevel` of the log call must +be greater or equal to the `LogLevel` of the `sharedLog` and the +`defaultLogLevel` additionally the condition passed must be `true`. Params: - ll = The $(D LogLevel) used by this log call. - condition = The condition must be $(D true) for the data to be logged. + ll = The `LogLevel` used by this log call. + condition = The condition must be `true` for the data to be logged. args = The data that should be logged. Examples: @@ -229,11 +229,11 @@ void log(T, string moduleName = __MODULE__)(const LogLevel ll, /** This function logs data. -In order for the data to be processed the $(D LogLevel) of the log call must -be greater or equal to the $(D LogLevel) of the $(D sharedLog). +In order for the data to be processed the `LogLevel` of the log call must +be greater or equal to the `LogLevel` of the `sharedLog`. Params: - ll = The $(D LogLevel) used by this log call. + ll = The `LogLevel` used by this log call. args = The data that should be logged. Examples: @@ -273,12 +273,12 @@ void log(T, string moduleName = __MODULE__)(const LogLevel ll, lazy T arg, /** This function logs data. -In order for the data to be processed the $(D LogLevel) of the -$(D sharedLog) must be greater or equal to the $(D defaultLogLevel) -add the condition passed must be $(D true). +In order for the data to be processed the `LogLevel` of the +`sharedLog` must be greater or equal to the `defaultLogLevel` +add the condition passed must be `true`. Params: - condition = The condition must be $(D true) for the data to be logged. + condition = The condition must be `true` for the data to be logged. args = The data that should be logged. Examples: @@ -312,8 +312,8 @@ void log(T, string moduleName = __MODULE__)(lazy bool condition, lazy T arg, /** This function logs data. -In order for the data to be processed the $(D LogLevel) of the -$(D sharedLog) must be greater or equal to the $(D defaultLogLevel). +In order for the data to be processed the `LogLevel` of the +`sharedLog` must be greater or equal to the `defaultLogLevel`. Params: args = The data that should be logged. @@ -347,16 +347,16 @@ void log(T)(lazy T arg, int line = __LINE__, string file = __FILE__, } } -/** This function logs data in a $(D printf)-style manner. +/** This function logs data in a `printf`-style manner. -In order for the data to be processed the $(D LogLevel) of the log call must -be greater or equal to the $(D LogLevel) of the $(D sharedLog) and the -$(D defaultLogLevel) additionally the condition passed must be $(D true). +In order for the data to be processed the `LogLevel` of the log call must +be greater or equal to the `LogLevel` of the `sharedLog` and the +`defaultLogLevel` additionally the condition passed must be `true`. Params: - ll = The $(D LogLevel) used by this log call. - condition = The condition must be $(D true) for the data to be logged. - msg = The $(D printf)-style string. + ll = The `LogLevel` used by this log call. + condition = The condition must be `true` for the data to be logged. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -380,15 +380,15 @@ void logf(int line = __LINE__, string file = __FILE__, } } -/** This function logs data in a $(D printf)-style manner. +/** This function logs data in a `printf`-style manner. -In order for the data to be processed the $(D LogLevel) of the log call must -be greater or equal to the $(D LogLevel) of the $(D sharedLog) and the -$(D defaultLogLevel). +In order for the data to be processed the `LogLevel` of the log call must +be greater or equal to the `LogLevel` of the `sharedLog` and the +`defaultLogLevel`. Params: - ll = The $(D LogLevel) used by this log call. - msg = The $(D printf)-style string. + ll = The `LogLevel` used by this log call. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -411,15 +411,15 @@ void logf(int line = __LINE__, string file = __FILE__, } } -/** This function logs data in a $(D printf)-style manner. +/** This function logs data in a `printf`-style manner. -In order for the data to be processed the $(D LogLevel) of the log call must -be greater or equal to the $(D defaultLogLevel) additionally the condition -passed must be $(D true). +In order for the data to be processed the `LogLevel` of the log call must +be greater or equal to the `defaultLogLevel` additionally the condition +passed must be `true`. Params: - condition = The condition must be $(D true) for the data to be logged. - msg = The $(D printf)-style string. + condition = The condition must be `true` for the data to be logged. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -439,13 +439,13 @@ void logf(int line = __LINE__, string file = __FILE__, } } -/** This function logs data in a $(D printf)-style manner. +/** This function logs data in a `printf`-style manner. -In order for the data to be processed the $(D LogLevel) of the log call must -be greater or equal to the $(D defaultLogLevel). +In order for the data to be processed the `LogLevel` of the log call must +be greater or equal to the `defaultLogLevel`. Params: - msg = The $(D printf)-style string. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -465,7 +465,7 @@ void logf(int line = __LINE__, string file = __FILE__, } } -/** This template provides the global log functions with the $(D LogLevel) +/** This template provides the global log functions with the `LogLevel` is encoded in the function name. The aliases following this template create the public names of these log @@ -500,13 +500,13 @@ template defaultLogFunction(LogLevel ll) } } -/** This function logs data to the $(D stdThreadLocalLog). +/** This function logs data to the `stdThreadLocalLog`. -In order for the resulting log message to be logged the $(D LogLevel) must -be greater or equal than the $(D LogLevel) of the $(D stdThreadLocalLog) and -must be greater or equal than the global $(D LogLevel). -Additionally the $(D LogLevel) must be greater or equal than the $(D LogLevel) -of the $(D stdSharedLogger). +In order for the resulting log message to be logged the `LogLevel` must +be greater or equal than the `LogLevel` of the `stdThreadLocalLog` and +must be greater or equal than the global `LogLevel`. +Additionally the `LogLevel` must be greater or equal than the `LogLevel` +of the `stdSharedLogger`. Params: args = The data that should be logged. @@ -520,18 +520,18 @@ critical(1337, "is number"); fatal(1337, "is number"); -------------------- -The second version of the function logs data to the $(D stdThreadLocalLog) depending +The second version of the function logs data to the `stdThreadLocalLog` depending on a condition. -In order for the resulting log message to be logged the $(D LogLevel) must -be greater or equal than the $(D LogLevel) of the $(D stdThreadLocalLog) and -must be greater or equal than the global $(D LogLevel) additionally the -condition passed must be $(D true). -Additionally the $(D LogLevel) must be greater or equal than the $(D LogLevel) -of the $(D stdSharedLogger). +In order for the resulting log message to be logged the `LogLevel` must +be greater or equal than the `LogLevel` of the `stdThreadLocalLog` and +must be greater or equal than the global `LogLevel` additionally the +condition passed must be `true`. +Additionally the `LogLevel` must be greater or equal than the `LogLevel` +of the `stdSharedLogger`. Params: - condition = The condition must be $(D true) for the data to be logged. + condition = The condition must be `true` for the data to be logged. args = The data that should be logged. Examples: @@ -555,8 +555,8 @@ alias critical = defaultLogFunction!(LogLevel.critical); /// Ditto alias fatal = defaultLogFunction!(LogLevel.fatal); -/** This template provides the global $(D printf)-style log functions with -the $(D LogLevel) is encoded in the function name. +/** This template provides the global `printf`-style log functions with +the `LogLevel` is encoded in the function name. The aliases following this template create the public names of the log functions. @@ -590,17 +590,17 @@ template defaultLogFunctionf(LogLevel ll) } } -/** This function logs data to the $(D sharedLog) in a $(D printf)-style +/** This function logs data to the `sharedLog` in a `printf`-style manner. -In order for the resulting log message to be logged the $(D LogLevel) must -be greater or equal than the $(D LogLevel) of the $(D sharedLog) and -must be greater or equal than the global $(D LogLevel). -Additionally the $(D LogLevel) must be greater or equal than the $(D LogLevel) -of the $(D stdSharedLogger). +In order for the resulting log message to be logged the `LogLevel` must +be greater or equal than the `LogLevel` of the `sharedLog` and +must be greater or equal than the global `LogLevel`. +Additionally the `LogLevel` must be greater or equal than the `LogLevel` +of the `stdSharedLogger`. Params: - msg = The $(D printf)-style string. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -612,18 +612,18 @@ criticalf("is number %d", 4); fatalf("is number %d", 5); -------------------- -The second version of the function logs data to the $(D sharedLog) in a $(D +The second version of the function logs data to the `sharedLog` in a $(D printf)-style manner. -In order for the resulting log message to be logged the $(D LogLevel) must -be greater or equal than the $(D LogLevel) of the $(D sharedLog) and -must be greater or equal than the global $(D LogLevel). -Additionally the $(D LogLevel) must be greater or equal than the $(D LogLevel) -of the $(D stdSharedLogger). +In order for the resulting log message to be logged the `LogLevel` must +be greater or equal than the `LogLevel` of the `sharedLog` and +must be greater or equal than the global `LogLevel`. +Additionally the `LogLevel` must be greater or equal than the `LogLevel` +of the `stdSharedLogger`. Params: - condition = The condition must be $(D true) for the data to be logged. - msg = The $(D printf)-style string. + condition = The condition must be `true` for the data to be logged. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -699,13 +699,13 @@ unittest /** There are eight usable logging level. These level are $(I all), $(I trace), $(I info), $(I warning), $(I error), $(I critical), $(I fatal), and $(I off). -If a log function with $(D LogLevel.fatal) is called the shutdown handler of +If a log function with `LogLevel.fatal` is called the shutdown handler of that logger is called. */ enum LogLevel : ubyte { - all = 1, /** Lowest possible assignable $(D LogLevel). */ - trace = 32, /** $(D LogLevel) for tracing the execution of the program. */ + all = 1, /** Lowest possible assignable `LogLevel`. */ + trace = 32, /** `LogLevel` for tracing the execution of the program. */ info = 64, /** This level is used to display information about the program. */ warning = 96, /** warnings about the program should be displayed with this @@ -716,15 +716,15 @@ enum LogLevel : ubyte logged with this level. */ fatal = 192, /** Log messages that describe fatal errors should use this level. */ - off = ubyte.max /** Highest possible $(D LogLevel). */ + off = ubyte.max /** Highest possible `LogLevel`. */ } /** This class is the base of every logger. In order to create a new kind of -logger a deriving class needs to implement the $(D writeLogMsg) method. By +logger a deriving class needs to implement the `writeLogMsg` method. By default this is not thread-safe. -It is also possible to $(D override) the three methods $(D beginLogMsg), -$(D logMsgPart) and $(D finishLogMsg) together, this option gives more +It is also possible to `override` the three methods `beginLogMsg`, +`logMsgPart` and `finishLogMsg` together, this option gives more flexibility. */ abstract class Logger @@ -746,7 +746,7 @@ abstract class Logger string prettyFuncName; /// the name of the module the log message is coming from string moduleName; - /// the $(D LogLevel) associated with the log message + /// the `LogLevel` associated with the log message LogLevel logLevel; /// thread id of the log message Tid threadId; @@ -754,16 +754,16 @@ abstract class Logger SysTime timestamp; /// the message of the log message string msg; - /// A refernce to the $(D Logger) used to create this $(D LogEntry) + /// A refernce to the `Logger` used to create this `LogEntry` Logger logger; } - /** This constructor takes a name of type $(D string), and a $(D LogLevel). + /** This constructor takes a name of type `string`, and a `LogLevel`. - Every subclass of $(D Logger) has to call this constructor from there - constructor. It sets the $(D LogLevel), the name of the $(D Logger), and - creates a fatal handler. The fatal handler will throw an $(D Error) if a - log call is made with a $(D LogLevel) $(D LogLevel.fatal). + Every subclass of `Logger` has to call this constructor from there + constructor. It sets the `LogLevel`, the name of the `Logger`, and + creates a fatal handler. The fatal handler will throw an `Error` if a + log call is made with a `LogLevel` `LogLevel.fatal`. */ this(LogLevel lv) @safe { @@ -776,7 +776,7 @@ abstract class Logger } /** A custom logger must implement this method in order to work in a - $(D MultiLogger) and $(D ArrayLogger). + `MultiLogger` and `ArrayLogger`. Params: payload = All information associated with call to log function. @@ -785,14 +785,14 @@ abstract class Logger */ abstract protected void writeLogMsg(ref LogEntry payload) @safe; - /* The default implementation will use an $(D std.array.appender) + /* The default implementation will use an `std.array.appender` internally to construct the message string. This means dynamic, GC memory allocation. A logger can avoid this allocation by - reimplementing $(D beginLogMsg), $(D logMsgPart) and $(D finishLogMsg). - $(D beginLogMsg) is always called first, followed by any number of calls - to $(D logMsgPart) and one call to $(D finishLogMsg). + reimplementing `beginLogMsg`, `logMsgPart` and `finishLogMsg`. + `beginLogMsg` is always called first, followed by any number of calls + to `logMsgPart` and one call to `finishLogMsg`. - As an example for such a custom $(D Logger) compare this: + As an example for such a custom `Logger` compare this: ---------------- class CLogger : Logger { @@ -848,7 +848,7 @@ abstract class Logger } /** Signals that the message has been written and no more calls to - $(D logMsgPart) follow. */ + `logMsgPart` follow. */ protected void finishLogMsg() @safe { static if (isLoggingActive) @@ -858,12 +858,12 @@ abstract class Logger } } - /** The $(D LogLevel) determines if the log call are processed or dropped - by the $(D Logger). In order for the log call to be processed the - $(D LogLevel) of the log call must be greater or equal to the $(D LogLevel) - of the $(D logger). + /** The `LogLevel` determines if the log call are processed or dropped + by the `Logger`. In order for the log call to be processed the + `LogLevel` of the log call must be greater or equal to the `LogLevel` + of the `logger`. - These two methods set and get the $(D LogLevel) of the used $(D Logger). + These two methods set and get the `LogLevel` of the used `Logger`. Example: ----------- @@ -883,10 +883,10 @@ abstract class Logger synchronized (mutex) this.logLevel_ = lv; } - /** This $(D delegate) is called in case a log message with - $(D LogLevel.fatal) gets logged. + /** This `delegate` is called in case a log message with + `LogLevel.fatal` gets logged. - By default an $(D Error) will be thrown. + By default an `Error` will be thrown. */ @property final void delegate() fatalHandler() const pure @safe @nogc { @@ -901,10 +901,10 @@ abstract class Logger /** This method allows forwarding log entries from one logger to another. - $(D forwardMsg) will ensure proper synchronization and then call - $(D writeLogMsg). This is an API for implementing your own loggers and + `forwardMsg` will ensure proper synchronization and then call + `writeLogMsg`. This is an API for implementing your own loggers and should not be called by normal user code. A notable difference from other - logging functions is that the $(D globalLogLevel) wont be evaluated again + logging functions is that the `globalLogLevel` wont be evaluated again since it is assumed that the caller already checked that. */ void forwardMsg(ref LogEntry payload) @trusted @@ -928,8 +928,8 @@ abstract class Logger } } - /** This template provides the log functions for the $(D Logger) $(D class) - with the $(D LogLevel) encoded in the function name. + /** This template provides the log functions for the `Logger` `class` + with the `LogLevel` encoded in the function name. For further information see the the two functions defined inside of this template. @@ -939,11 +939,11 @@ abstract class Logger */ template memLogFunctions(LogLevel ll) { - /** This function logs data to the used $(D Logger). + /** This function logs data to the used `Logger`. - In order for the resulting log message to be logged the $(D LogLevel) - must be greater or equal than the $(D LogLevel) of the used $(D Logger) - and must be greater or equal than the global $(D LogLevel). + In order for the resulting log message to be logged the `LogLevel` + must be greater or equal than the `LogLevel` of the used `Logger` + and must be greater or equal than the global `LogLevel`. Params: args = The data that should be logged. @@ -983,16 +983,16 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) depending on a + /** This function logs data to the used `Logger` depending on a condition. - In order for the resulting log message to be logged the $(D LogLevel) must - be greater or equal than the $(D LogLevel) of the used $(D Logger) and - must be greater or equal than the global $(D LogLevel) additionally the - condition passed must be $(D true). + In order for the resulting log message to be logged the `LogLevel` must + be greater or equal than the `LogLevel` of the used `Logger` and + must be greater or equal than the global `LogLevel` additionally the + condition passed must be `true`. Params: - condition = The condition must be $(D true) for the data to be logged. + condition = The condition must be `true` for the data to be logged. args = The data that should be logged. Examples: @@ -1031,17 +1031,17 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) in a - $(D printf)-style manner. + /** This function logs data to the used `Logger` in a + `printf`-style manner. - In order for the resulting log message to be logged the $(D LogLevel) - must be greater or equal than the $(D LogLevel) of the used $(D Logger) - and must be greater or equal than the global $(D LogLevel) additionally - the passed condition must be $(D true). + In order for the resulting log message to be logged the `LogLevel` + must be greater or equal than the `LogLevel` of the used `Logger` + and must be greater or equal than the global `LogLevel` additionally + the passed condition must be `true`. Params: - condition = The condition must be $(D true) for the data to be logged. - msg = The $(D printf)-style string. + condition = The condition must be `true` for the data to be logged. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -1080,15 +1080,15 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) in a - $(D printf)-style manner. + /** This function logs data to the used `Logger` in a + `printf`-style manner. - In order for the resulting log message to be logged the $(D LogLevel) must - be greater or equal than the $(D LogLevel) of the used $(D Logger) and - must be greater or equal than the global $(D LogLevel). + In order for the resulting log message to be logged the `LogLevel` must + be greater or equal than the `LogLevel` of the used `Logger` and + must be greater or equal than the global `LogLevel`. Params: - msg = The $(D printf)-style string. + msg = The `printf`-style string. args = The data that should be logged. Examples: @@ -1152,15 +1152,15 @@ abstract class Logger /// Ditto alias fatalf = memLogFunctions!(LogLevel.fatal).logImplf; - /** This method logs data with the $(D LogLevel) of the used $(D Logger). + /** This method logs data with the `LogLevel` of the used `Logger`. - This method takes a $(D bool) as first argument. In order for the - data to be processed the $(D bool) must be $(D true) and the $(D LogLevel) - of the Logger must be greater or equal to the global $(D LogLevel). + This method takes a `bool` as first argument. In order for the + data to be processed the `bool` must be `true` and the `LogLevel` + of the Logger must be greater or equal to the global `LogLevel`. Params: args = The data that should be logged. - condition = The condition must be $(D true) for the data to be logged. + condition = The condition must be `true` for the data to be logged. args = The data that is to be logged. Returns: The logger used by the logging function as reference. @@ -1220,15 +1220,15 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) with a specific - $(D LogLevel). + /** This function logs data to the used `Logger` with a specific + `LogLevel`. - In order for the resulting log message to be logged the $(D LogLevel) - must be greater or equal than the $(D LogLevel) of the used $(D Logger) - and must be greater or equal than the global $(D LogLevel). + In order for the resulting log message to be logged the `LogLevel` + must be greater or equal than the `LogLevel` of the used `Logger` + and must be greater or equal than the global `LogLevel`. Params: - ll = The specific $(D LogLevel) used for logging the log message. + ll = The specific `LogLevel` used for logging the log message. args = The data that should be logged. Examples: @@ -1289,16 +1289,16 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) depending on a - explicitly passed condition with the $(D LogLevel) of the used - $(D Logger). + /** This function logs data to the used `Logger` depending on a + explicitly passed condition with the `LogLevel` of the used + `Logger`. - In order for the resulting log message to be logged the $(D LogLevel) - of the used $(D Logger) must be greater or equal than the global - $(D LogLevel) and the condition must be $(D true). + In order for the resulting log message to be logged the `LogLevel` + of the used `Logger` must be greater or equal than the global + `LogLevel` and the condition must be `true`. Params: - condition = The condition must be $(D true) for the data to be logged. + condition = The condition must be `true` for the data to be logged. args = The data that should be logged. Examples: @@ -1361,12 +1361,12 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) with the $(D LogLevel) - of the used $(D Logger). + /** This function logs data to the used `Logger` with the `LogLevel` + of the used `Logger`. - In order for the resulting log message to be logged the $(D LogLevel) - of the used $(D Logger) must be greater or equal than the global - $(D LogLevel). + In order for the resulting log message to be logged the `LogLevel` + of the used `Logger` must be greater or equal than the global + `LogLevel`. Params: args = The data that should be logged. @@ -1431,17 +1431,17 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) with a specific - $(D LogLevel) and depending on a condition in a $(D printf)-style manner. + /** This function logs data to the used `Logger` with a specific + `LogLevel` and depending on a condition in a `printf`-style manner. - In order for the resulting log message to be logged the $(D LogLevel) - must be greater or equal than the $(D LogLevel) of the used $(D Logger) - and must be greater or equal than the global $(D LogLevel) and the - condition must be $(D true). + In order for the resulting log message to be logged the `LogLevel` + must be greater or equal than the `LogLevel` of the used `Logger` + and must be greater or equal than the global `LogLevel` and the + condition must be `true`. Params: - ll = The specific $(D LogLevel) used for logging the log message. - condition = The condition must be $(D true) for the data to be logged. + ll = The specific `LogLevel` used for logging the log message. + condition = The condition must be `true` for the data to be logged. msg = The format string used for this log call. args = The data that should be logged. @@ -1479,15 +1479,15 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) with a specific - $(D LogLevel) in a $(D printf)-style manner. + /** This function logs data to the used `Logger` with a specific + `LogLevel` in a `printf`-style manner. - In order for the resulting log message to be logged the $(D LogLevel) - must be greater or equal than the $(D LogLevel) of the used $(D Logger) - and must be greater or equal than the global $(D LogLevel). + In order for the resulting log message to be logged the `LogLevel` + must be greater or equal than the `LogLevel` of the used `Logger` + and must be greater or equal than the global `LogLevel`. Params: - ll = The specific $(D LogLevel) used for logging the log message. + ll = The specific `LogLevel` used for logging the log message. msg = The format string used for this log call. args = The data that should be logged. @@ -1525,16 +1525,16 @@ abstract class Logger } } - /** This function logs data to the used $(D Logger) depending on a - condition with the $(D LogLevel) of the used $(D Logger) in a - $(D printf)-style manner. + /** This function logs data to the used `Logger` depending on a + condition with the `LogLevel` of the used `Logger` in a + `printf`-style manner. - In order for the resulting log message to be logged the $(D LogLevel) - of the used $(D Logger) must be greater or equal than the global - $(D LogLevel) and the condition must be $(D true). + In order for the resulting log message to be logged the `LogLevel` + of the used `Logger` must be greater or equal than the global + `LogLevel` and the condition must be `true`. Params: - condition = The condition must be $(D true) for the data to be logged. + condition = The condition must be `true` for the data to be logged. msg = The format string used for this log call. args = The data that should be logged. @@ -1575,11 +1575,11 @@ abstract class Logger } } - /** This method logs data to the used $(D Logger) with the $(D LogLevel) - of the this $(D Logger) in a $(D printf)-style manner. + /** This method logs data to the used `Logger` with the `LogLevel` + of the this `Logger` in a `printf`-style manner. - In order for the data to be processed the $(D LogLevel) of the $(D Logger) - must be greater or equal to the global $(D LogLevel). + In order for the data to be processed the `LogLevel` of the `Logger` + must be greater or equal to the global `LogLevel`. Params: msg = The format string used for this log call. @@ -1654,22 +1654,22 @@ private @property Logger defaultSharedLoggerImpl() @trusted return stdSharedDefaultLogger; } -/** This property sets and gets the default $(D Logger). +/** This property sets and gets the default `Logger`. Example: ------------- sharedLog = new FileLogger(yourFile); ------------- -The example sets a new $(D FileLogger) as new $(D sharedLog). +The example sets a new `FileLogger` as new `sharedLog`. If at some point you want to use the original default logger again, you can use $(D sharedLog = null;). This will put back the original. Note: -While getting and setting $(D sharedLog) is thread-safe, it has to be considered +While getting and setting `sharedLog` is thread-safe, it has to be considered that the returned reference is only a current snapshot and in the following code, you must make sure no other thread reassigns to it between reading and -writing $(D sharedLog). +writing `sharedLog`. ------------- if (sharedLog !is myLogger) sharedLog = new myLogger; @@ -1700,11 +1700,11 @@ if (sharedLog !is myLogger) atomicStore!(MemoryOrder.rel)(stdSharedLogger, cast(shared) logger); } -/** This methods get and set the global $(D LogLevel). +/** This methods get and set the global `LogLevel`. -Every log message with a $(D LogLevel) lower as the global $(D LogLevel) -will be discarded before it reaches $(D writeLogMessage) method of any -$(D Logger). +Every log message with a `LogLevel` lower as the global `LogLevel` +will be discarded before it reaches `writeLogMessage` method of any +`Logger`. */ /* Implementation note: For any public logging call, the global log level shall only be queried once on @@ -1724,18 +1724,18 @@ different levels at different spots in the code. // Thread Local -/** The $(D StdForwardLogger) will always forward anything to the sharedLog. +/** The `StdForwardLogger` will always forward anything to the sharedLog. -The $(D StdForwardLogger) will not throw if data is logged with $(D +The `StdForwardLogger` will not throw if data is logged with $(D LogLevel.fatal). */ class StdForwardLogger : Logger { - /** The default constructor for the $(D StdForwardLogger). + /** The default constructor for the `StdForwardLogger`. Params: - lv = The $(D LogLevel) for the $(D MultiLogger). By default the $(D - LogLevel) is $(D all). + lv = The `LogLevel` for the `MultiLogger`. By default the $(D + LogLevel) is `all`. */ this(const LogLevel lv = LogLevel.all) @safe { @@ -1755,9 +1755,9 @@ class StdForwardLogger : Logger auto nl1 = new StdForwardLogger(LogLevel.all); } -/** This $(D LogLevel) is unqiue to every thread. +/** This `LogLevel` is unqiue to every thread. -The thread local $(D Logger) will use this $(D LogLevel) to filter log calls +The thread local `Logger` will use this `LogLevel` to filter log calls every same way as presented earlier. */ //public LogLevel threadLogLevel = LogLevel.all; @@ -1779,14 +1779,14 @@ private @property Logger stdThreadLocalLogImpl() @trusted return stdLoggerDefaultThreadLogger; } -/** This function returns a thread unique $(D Logger), that by default -propergates all data logged to it to the $(D sharedLog). +/** This function returns a thread unique `Logger`, that by default +propergates all data logged to it to the `sharedLog`. -These properties can be used to set and get this $(D Logger). Every -modification to this $(D Logger) will only be visible in the thread the +These properties can be used to set and get this `Logger`. Every +modification to this `Logger` will only be visible in the thread the modification has been done from. -This $(D Logger) is called by the free standing log functions. This allows to +This `Logger` is called by the free standing log functions. This allows to create thread local redirections and still use the free standing log functions. */ diff --git a/std/experimental/logger/filelogger.d b/std/experimental/logger/filelogger.d index 270e962f475..b678f3fcb00 100644 --- a/std/experimental/logger/filelogger.d +++ b/std/experimental/logger/filelogger.d @@ -3,7 +3,7 @@ module std.experimental.logger.filelogger; import std.stdio; import std.experimental.logger.core; -/** This $(D Logger) implementation writes log messages to the associated +/** This `Logger` implementation writes log messages to the associated file. The name of the file has to be passed on construction time. If the file is already present new log messages will be append at its end. */ @@ -13,13 +13,13 @@ class FileLogger : Logger import std.datetime : SysTime; import std.concurrency : Tid; - /** A constructor for the $(D FileLogger) Logger. + /** A constructor for the `FileLogger` Logger. Params: - fn = The filename of the output file of the $(D FileLogger). If that + fn = The filename of the output file of the `FileLogger`. If that file can not be opened for writting an exception will be thrown. - lv = The $(D LogLevel) for the $(D FileLogger). By default the - $(D LogLevel) for $(D FileLogger) is $(D LogLevel.info). + lv = The `LogLevel` for the `FileLogger`. By default the + `LogLevel` for `FileLogger` is `LogLevel.info`. Example: ------------- @@ -35,17 +35,17 @@ class FileLogger : Logger this.file_.open(this.filename, "a"); } - /** A constructor for the $(D FileLogger) Logger that takes a reference to - a $(D File). + /** A constructor for the `FileLogger` Logger that takes a reference to + a `File`. - The $(D File) passed must be open for all the log call to the - $(D FileLogger). If the $(D File) gets closed, using the $(D FileLogger) + The `File` passed must be open for all the log call to the + `FileLogger`. If the `File` gets closed, using the `FileLogger` for logging will result in undefined behaviour. Params: file = The file used for logging. - lv = The $(D LogLevel) for the $(D FileLogger). By default the - $(D LogLevel) for $(D FileLogger) is $(D LogLevel.info). + lv = The `LogLevel` for the `FileLogger`. By default the + `LogLevel` for `FileLogger` is `LogLevel.info`. Example: ------------- @@ -60,7 +60,7 @@ class FileLogger : Logger this.file_ = file; } - /** If the $(D FileLogger) is managing the $(D File) it logs to, this + /** If the `FileLogger` is managing the `File` it logs to, this method will return a reference to this File. */ @property File file() @safe @@ -69,7 +69,7 @@ class FileLogger : Logger } /* This method overrides the base class method in order to log to a file - without requiring heap allocated memory. Additionally, the $(D FileLogger) + without requiring heap allocated memory. Additionally, the `FileLogger` local mutex is logged to serialize the log calls. */ override protected void beginLogMsg(string file, int line, string funcName, @@ -96,8 +96,8 @@ class FileLogger : Logger } /* This methods overrides the base class method and finalizes the active - log call. This requires flushing the $(D File) and releasing the - $(D FileLogger) local mutex. + log call. This requires flushing the `File` and releasing the + `FileLogger` local mutex. */ override protected void finishLogMsg() { @@ -106,7 +106,7 @@ class FileLogger : Logger } /* This methods overrides the base class method and delegates the - $(D LogEntry) data to the actual implementation. + `LogEntry` data to the actual implementation. */ override protected void writeLogMsg(ref LogEntry payload) { @@ -117,8 +117,8 @@ class FileLogger : Logger this.finishLogMsg(); } - /** If the $(D FileLogger) was constructed with a filename, this method - returns this filename. Otherwise an empty $(D string) is returned. + /** If the `FileLogger` was constructed with a filename, this method + returns this filename. Otherwise an empty `string` is returned. */ string getFilename() { diff --git a/std/experimental/logger/multilogger.d b/std/experimental/logger/multilogger.d index 18ec7213dcf..4782fe06635 100644 --- a/std/experimental/logger/multilogger.d +++ b/std/experimental/logger/multilogger.d @@ -3,31 +3,31 @@ module std.experimental.logger.multilogger; import std.experimental.logger.core; import std.experimental.logger.filelogger; -/** This Element is stored inside the $(D MultiLogger) and associates a -$(D Logger) to a $(D string). +/** This Element is stored inside the `MultiLogger` and associates a +`Logger` to a `string`. */ struct MultiLoggerEntry { - string name; /// The name if the $(D Logger) - Logger logger; /// The stored $(D Logger) + string name; /// The name if the `Logger` + Logger logger; /// The stored `Logger` } -/** MultiLogger logs to multiple $(D Logger). The $(D Logger)s are stored in an -$(D Logger[]) in there order of insertion. +/** MultiLogger logs to multiple `Logger`. The `Logger`s are stored in an +`Logger[]` in there order of insertion. -Every data logged to this $(D MultiLogger) will be distributed to all the $(D -Logger)s inserted into inserted it. This $(D MultiLogger) implementation can -hold multiple $(D Logger)s with the same name. If the method $(D removeLogger) -is used to remove a $(D Logger) only the first occurrence with that name will +Every data logged to this `MultiLogger` will be distributed to all the $(D +Logger)s inserted into inserted it. This `MultiLogger` implementation can +hold multiple `Logger`s with the same name. If the method `removeLogger` +is used to remove a `Logger` only the first occurrence with that name will be removed. */ class MultiLogger : Logger { - /** A constructor for the $(D MultiLogger) Logger. + /** A constructor for the `MultiLogger` Logger. Params: - lv = The $(D LogLevel) for the $(D MultiLogger). By default the - $(D LogLevel) for $(D MultiLogger) is $(D LogLevel.info). + lv = The `LogLevel` for the `MultiLogger`. By default the + `LogLevel` for `MultiLogger` is `LogLevel.info`. Example: ------------- @@ -39,32 +39,32 @@ class MultiLogger : Logger super(lv); } - /** This member holds all $(D Logger) stored in the $(D MultiLogger). + /** This member holds all `Logger` stored in the `MultiLogger`. - When inheriting from $(D MultiLogger) this member can be used to gain - access to the stored $(D Logger). + When inheriting from `MultiLogger` this member can be used to gain + access to the stored `Logger`. */ protected MultiLoggerEntry[] logger; - /** This method inserts a new Logger into the $(D MultiLogger). + /** This method inserts a new Logger into the `MultiLogger`. Params: - name = The name of the $(D Logger) to insert. - newLogger = The $(D Logger) to insert. + name = The name of the `Logger` to insert. + newLogger = The `Logger` to insert. */ void insertLogger(string name, Logger newLogger) @safe { this.logger ~= MultiLoggerEntry(name, newLogger); } - /** This method removes a Logger from the $(D MultiLogger). + /** This method removes a Logger from the `MultiLogger`. Params: - toRemove = The name of the $(D Logger) to remove. If the $(D Logger) - is not found $(D null) will be returned. Only the first occurrence of - a $(D Logger) with the given name will be removed. + toRemove = The name of the `Logger` to remove. If the `Logger` + is not found `null` will be returned. Only the first occurrence of + a `Logger` with the given name will be removed. - Returns: The removed $(D Logger). + Returns: The removed `Logger`. */ Logger removeLogger(in char[] toRemove) @safe { @@ -86,7 +86,7 @@ class MultiLogger : Logger } /* The override to pass the payload to all children of the - $(D MultiLoggerBase). + `MultiLoggerBase`. */ override protected void writeLogMsg(ref LogEntry payload) @safe { diff --git a/std/experimental/logger/nulllogger.d b/std/experimental/logger/nulllogger.d index bfa7981144e..d7b19dcbb74 100644 --- a/std/experimental/logger/nulllogger.d +++ b/std/experimental/logger/nulllogger.d @@ -2,19 +2,19 @@ module std.experimental.logger.nulllogger; import std.experimental.logger.core; -/** The $(D NullLogger) will not process any log messages. +/** The `NullLogger` will not process any log messages. -In case of a log message with $(D LogLevel.fatal) nothing will happen. +In case of a log message with `LogLevel.fatal` nothing will happen. */ class NullLogger : Logger { - /** The default constructor for the $(D NullLogger). + /** The default constructor for the `NullLogger`. Independent of the parameter this Logger will never log a message. Params: - lv = The $(D LogLevel) for the $(D NullLogger). By default the $(D LogLevel) - for $(D NullLogger) is $(D LogLevel.info). + lv = The `LogLevel` for the `NullLogger`. By default the `LogLevel` + for `NullLogger` is `LogLevel.info`. */ this(const LogLevel lv = LogLevel.info) @safe { diff --git a/std/experimental/logger/package.d b/std/experimental/logger/package.d index f45320a7c3d..103a06656f0 100644 --- a/std/experimental/logger/package.d +++ b/std/experimental/logger/package.d @@ -3,11 +3,11 @@ Implements logging facilities. Message logging is a common approach to expose runtime information of a program. Logging should be easy, but also flexible and powerful, therefore -$(D D) provides a standard interface for logging. +`D` provides a standard interface for logging. The easiest way to create a log message is to write $(D import std.logger; log("I am here");) this will print a message to the -$(D stderr) device. The message will contain the filename, the linenumber, the +`stderr` device. The message will contain the filename, the linenumber, the name of the surrounding function, the time and the message. Copyright: Copyright Robert "burner" Schadek 2013 -- @@ -34,61 +34,61 @@ fLogger.log(LogLevel.trace, 5 < 6, "Logging to the fileLogger"," with its defaul fLogger.fatal("Logging to the fileLogger with its warning LogLevel"); ------------- -Top-level calls to logging-related functions go to the default $(D Logger) -object called $(D sharedLog). -$(LI $(D log)) -$(LI $(D trace)) -$(LI $(D info)) -$(LI $(D warning)) -$(LI $(D critical)) -$(LI $(D fatal)) -The default $(D Logger) will by default log to $(D stderr) and has a default -$(D LogLevel) of $(D LogLevel.all). The default Logger can be accessed by -using the property called $(D sharedLog). This property a reference to the -current default $(D Logger). This reference can be used to assign a new -default $(D Logger). +Top-level calls to logging-related functions go to the default `Logger` +object called `sharedLog`. +$(LI `log`) +$(LI `trace`) +$(LI `info`) +$(LI `warning`) +$(LI `critical`) +$(LI `fatal`) +The default `Logger` will by default log to `stderr` and has a default +`LogLevel` of `LogLevel.all`. The default Logger can be accessed by +using the property called `sharedLog`. This property a reference to the +current default `Logger`. This reference can be used to assign a new +default `Logger`. ------------- sharedLog = new FileLogger("New_Default_Log_File.log"); ------------- -Additional $(D Logger) can be created by creating a new instance of the -required $(D Logger). - -The $(D LogLevel) of an log call can be defined in two ways. The first is by -calling $(D log) and passing the $(D LogLevel) explicit as the first argument. -The second way of setting the $(D LogLevel) of a -log call, is by calling either $(D trace), $(D info), $(D warning), -$(D critical), or $(D fatal). The log call will than have the respective -$(D LogLevel). If no $(D LogLevel) is defined the log call will use the -current $(D LogLevel) of the used $(D Logger). If data is logged with -$(D LogLevel) $(D fatal) by default an $(D Error) will be thrown. -This behaviour can be modified by using the member $(D fatalHandler) to -assign a custom delegate to handle log call with $(D LogLevel) $(D fatal). - -Conditional logging can be achieved be appending passing a $(D bool) as first +Additional `Logger` can be created by creating a new instance of the +required `Logger`. + +The `LogLevel` of an log call can be defined in two ways. The first is by +calling `log` and passing the `LogLevel` explicit as the first argument. +The second way of setting the `LogLevel` of a +log call, is by calling either `trace`, `info`, `warning`, +`critical`, or `fatal`. The log call will than have the respective +`LogLevel`. If no `LogLevel` is defined the log call will use the +current `LogLevel` of the used `Logger`. If data is logged with +`LogLevel` `fatal` by default an `Error` will be thrown. +This behaviour can be modified by using the member `fatalHandler` to +assign a custom delegate to handle log call with `LogLevel` `fatal`. + +Conditional logging can be achieved be appending passing a `bool` as first argument to a log function. If conditional logging is used the condition must -be $(D true) in order to have the log message logged. +be `true` in order to have the log message logged. -In order to combine an explicit $(D LogLevel) passing with conditional -logging, the $(D LogLevel) has to be passed as first argument followed by the -$(D bool). +In order to combine an explicit `LogLevel` passing with conditional +logging, the `LogLevel` has to be passed as first argument followed by the +`bool`. -Messages are logged if the $(D LogLevel) of the log message is greater than or -equal to than the $(D LogLevel) of the used $(D Logger) and additionally if the -$(D LogLevel) of the log message is greater equal to the global $(D LogLevel). +Messages are logged if the `LogLevel` of the log message is greater than or +equal to than the `LogLevel` of the used `Logger` and additionally if the +`LogLevel` of the log message is greater equal to the global `LogLevel`. If a condition is passed into the log call, this condition must be true. -The global $(D LogLevel) is accessible by using $(D globalLogLevel). -To assign the $(D LogLevel) of a $(D Logger) use the $(D logLevel) property of +The global `LogLevel` is accessible by using `globalLogLevel`. +To assign the `LogLevel` of a `Logger` use the `logLevel` property of the logger. -If $(D printf)-style logging is needed add a $(B f) to the logging call, such as +If `printf`-style logging is needed add a $(B f) to the logging call, such as $(D myLogger.infof("Hello %s", "world");) or $(fatalf("errno %d", 1337)) -The additional $(B f) enables $(D printf)-style logging for call combinations of -explicit $(D LogLevel) and conditional logging functions and methods. +The additional $(B f) enables `printf`-style logging for call combinations of +explicit `LogLevel` and conditional logging functions and methods. -To customize the $(D Logger) behavior, create a new $(D class) that inherits from -the abstract $(D Logger) $(D class), and implements the $(D writeLogMsg) +To customize the `Logger` behavior, create a new `class` that inherits from +the abstract `Logger` `class`, and implements the `writeLogMsg` method. ------------- class MyCustomLogger : Logger @@ -109,38 +109,38 @@ logger.log("Awesome log message"); ------------- To gain more precise control over the logging process, additionally to -overwriting the $(D writeLogMsg) method the methods $(D beginLogMsg), -$(D logMsgPart) and $(D finishLogMsg) can be overwritten. +overwriting the `writeLogMsg` method the methods `beginLogMsg`, +`logMsgPart` and `finishLogMsg` can be overwritten. -In order to disable logging at compile time, pass $(D StdLoggerDisableLogging) as a -version argument to the $(D D) compiler when compiling your program code. +In order to disable logging at compile time, pass `StdLoggerDisableLogging` as a +version argument to the `D` compiler when compiling your program code. This will disable all logging functionality. -Specific $(D LogLevel) can be disabled at compile time as well. -In order to disable logging with the $(D trace) $(D LogLevel) pass -$(D StdLoggerDisableTrace) as a version. +Specific `LogLevel` can be disabled at compile time as well. +In order to disable logging with the `trace` `LogLevel` pass +`StdLoggerDisableTrace` as a version. The following table shows which version statement disables which -$(D LogLevel). +`LogLevel`. $(TABLE - $(TR $(TD $(D LogLevel.trace) ) $(TD StdLoggerDisableTrace)) - $(TR $(TD $(D LogLevel.info) ) $(TD StdLoggerDisableInfo)) - $(TR $(TD $(D LogLevel.warning) ) $(TD StdLoggerDisableWarning)) - $(TR $(TD $(D LogLevel.error) ) $(TD StdLoggerDisableError)) - $(TR $(TD $(D LogLevel.critical) ) $(TD StdLoggerDisableCritical)) - $(TR $(TD $(D LogLevel.fatal) ) $(TD StdLoggerDisableFatal)) + $(TR $(TD `LogLevel.trace` ) $(TD StdLoggerDisableTrace)) + $(TR $(TD `LogLevel.info` ) $(TD StdLoggerDisableInfo)) + $(TR $(TD `LogLevel.warning` ) $(TD StdLoggerDisableWarning)) + $(TR $(TD `LogLevel.error` ) $(TD StdLoggerDisableError)) + $(TR $(TD `LogLevel.critical` ) $(TD StdLoggerDisableCritical)) + $(TR $(TD `LogLevel.fatal` ) $(TD StdLoggerDisableFatal)) ) Such a version statement will only disable logging in the associated compile unit. -By default four $(D Logger) implementations are given. The $(D FileLogger) -logs data to files. It can also be used to log to $(D stdout) and $(D stderr) -as these devices are files as well. A $(D Logger) that logs to $(D stdout) can +By default four `Logger` implementations are given. The `FileLogger` +logs data to files. It can also be used to log to `stdout` and `stderr` +as these devices are files as well. A `Logger` that logs to `stdout` can therefore be created by $(D new FileLogger(stdout)). -The $(D MultiLogger) is basically an associative array of $(D string)s to -$(D Logger). It propagates log calls to its stored $(D Logger). The -$(D ArrayLogger) contains an array of $(D Logger) and also propagates log -calls to its stored $(D Logger). The $(D NullLogger) does not do anything. It -will never log a message and will never throw on a log call with $(D LogLevel) -$(D error). +The `MultiLogger` is basically an associative array of `string`s to +`Logger`. It propagates log calls to its stored `Logger`. The +`ArrayLogger` contains an array of `Logger` and also propagates log +calls to its stored `Logger`. The `NullLogger` does not do anything. It +will never log a message and will never throw on a log call with `LogLevel` +`error`. */ module std.experimental.logger; diff --git a/std/file.d b/std/file.d index f2437621cb6..08daaa5ba7f 100644 --- a/std/file.d +++ b/std/file.d @@ -4,7 +4,7 @@ Utilities for manipulating files and scanning directories. Functions in this module handle files as a unit, e.g., read or write one _file at a time. For opening files and manipulating them via handles refer -to module $(LINK2 std_stdio.html,$(D std.stdio)). +to module $(LINK2 std_stdio.html,`std.stdio`). Macros: WIKI = Phobos/StdFile @@ -171,8 +171,8 @@ private T cenforce(T)(T condition, lazy const(char)[] name, string file = __FILE */ /******************************************** -Read entire contents of file $(D name) and returns it as an untyped -array. If the file size is larger than $(D upTo), only $(D upTo) +Read entire contents of file `name` and returns it as an untyped +array. If the file size is larger than `upTo`, only `upTo` bytes are read. Example: @@ -189,7 +189,7 @@ void main() Returns: Untyped array of bytes _read. -Throws: $(D FileException) on error. +Throws: `FileException` on error. */ void[] read(in char[] name, size_t upTo = size_t.max) @safe { @@ -332,15 +332,15 @@ version (linux) @safe unittest } /******************************************** -Read and validates (using $(XREF utf, validate)) a text file. $(D S) +Read and validates (using $(XREF utf, validate)) a text file. `S` can be a type of array of characters of any width and constancy. No width conversion is performed; if the width of the characters in file -$(D name) is different from the width of elements of $(D S), +`name` is different from the width of elements of `S`, validation will fail. Returns: Array of characters read. -Throws: $(D FileException) on file error, $(D UTFException) on UTF +Throws: `FileException` on file error, `UTFException` on UTF decoding error. Example: @@ -370,8 +370,8 @@ S readText(S = string)(in char[] name) @safe if (isSomeString!S) } /********************************************* -Write $(D buffer) to file $(D name). -Throws: $(D FileException) on error. +Write `buffer` to file `name`. +Throws: `FileException` on error. Example: @@ -407,8 +407,8 @@ void write(in char[] name, const void[] buffer) @trusted } /********************************************* -Appends $(D buffer) to file $(D name). -Throws: $(D FileException) on error. +Appends `buffer` to file `name`. +Throws: `FileException` on error. Example: @@ -465,9 +465,9 @@ version(Posix) private void writeImpl(in char[] name, } /*************************************************** - * Rename file $(D from) to $(D to). + * Rename file `from` to `to`. * If the target file exists, it is overwritten. - * Throws: $(D FileException) on error. + * Throws: `FileException` on error. */ void rename(in char[] from, in char[] to) @trusted { @@ -500,8 +500,8 @@ void rename(in char[] from, in char[] to) @trusted /*************************************************** -Delete file $(D name). -Throws: $(D FileException) on error. +Delete file `name`. +Throws: `FileException` on error. */ void remove(in char[] name) @trusted { @@ -534,9 +534,9 @@ version(Windows) private ulong makeUlong(DWORD dwLow, DWORD dwHigh) @safe pure n } /*************************************************** -Get size of file $(D name) in bytes. +Get size of file `name` in bytes. -Throws: $(D FileException) on error (e.g., file not found). +Throws: `FileException` on error (e.g., file not found). */ ulong getSize(in char[] name) @safe { @@ -574,7 +574,7 @@ ulong getSize(in char[] name) @safe /++ - Get the access and modified times of file or folder $(D name). + Get the access and modified times of file or folder `name`. Params: name = File/Folder name to get times for. @@ -582,7 +582,7 @@ ulong getSize(in char[] name) @safe modificationTime = Time the file/folder was last modified. Throws: - $(D FileException) on error. + `FileException` on error. +/ void getTimes(in char[] name, out SysTime accessTime, @@ -669,9 +669,9 @@ unittest /++ $(BLUE This function is Windows-Only.) - Get creation/access/modified times of file $(D name). + Get creation/access/modified times of file `name`. - This is the same as $(D getTimes) except that it also gives you the file + This is the same as `getTimes` except that it also gives you the file creation time - which isn't possible on Posix systems. Params: @@ -681,7 +681,7 @@ unittest fileModificationTime = Time the file was last modified. Throws: - $(D FileException) on error. + `FileException` on error. +/ version(StdDdoc) void getTimesWin(in char[] name, out SysTime fileCreationTime, @@ -767,7 +767,7 @@ version(Windows) unittest /++ - Set access/modified times of file or folder $(D name). + Set access/modified times of file or folder `name`. Params: name = File/Folder name to get times for. @@ -775,7 +775,7 @@ version(Windows) unittest modificationTime = Time the file/folder was last modified. Throws: - $(D FileException) on error. + `FileException` on error. +/ void setTimes(in char[] name, SysTime accessTime, @@ -867,7 +867,7 @@ unittest Returns the time that the given file was last modified. Throws: - $(D FileException) if the given file does not exist. + `FileException` if the given file does not exist. +/ SysTime timeLastModified(in char[] name) @safe { @@ -897,16 +897,16 @@ SysTime timeLastModified(in char[] name) @safe /++ Returns the time that the given file was last modified. If the - file does not exist, returns $(D returnIfMissing). + file does not exist, returns `returnIfMissing`. A frequent usage pattern occurs in build automation tools such as $(WEB gnu.org/software/make, make) or $(WEB en.wikipedia.org/wiki/Apache_Ant, ant). To check whether file $(D - target) must be rebuilt from file $(D source) (i.e., $(D target) is - older than $(D source) or does not exist), use the comparison - below. The code throws a $(D FileException) if $(D source) does not - exist (as it should). On the other hand, the $(D SysTime.min) default - makes a non-existing $(D target) seem infinitely old so the test + target) must be rebuilt from file `source` (i.e., `target` is + older than `source` or does not exist), use the comparison + below. The code throws a `FileException` if `source` does not + exist (as it should). On the other hand, the `SysTime.min` default + makes a non-existing `target` seem infinitely old so the test correctly prompts building it. Params: @@ -1029,7 +1029,7 @@ bool exists(in char[] name) @trusted nothrow @nogc msdn.microsoft.com/en-us/library/aa364944(v=vs.85).aspx, GetFileAttributes), whereas on Posix systems, they're the $(LUCKY st_mode) value which is part of the $(D stat struct) gotten by - calling the $(WEB en.wikipedia.org/wiki/Stat_%28Unix%29, $(D stat)) + calling the $(WEB en.wikipedia.org/wiki/Stat_%28Unix%29, `stat`) function. On Posix systems, if the given file is a symbolic link, then @@ -1039,7 +1039,7 @@ bool exists(in char[] name) @trusted nothrow @nogc Params: name = The file to get the attributes of. - Throws: $(D FileException) on error. + Throws: `FileException` on error. +/ uint getAttributes(in char[] name) @safe { @@ -1084,7 +1084,7 @@ uint getAttributes(in char[] name) @safe name = The file to get the symbolic link attributes of. Throws: - $(D FileException) on error. + `FileException` on error. +/ uint getLinkAttributes(in char[] name) @safe { @@ -1109,7 +1109,7 @@ uint getLinkAttributes(in char[] name) @safe Set the attributes of the given file. Throws: - $(D FileException) if the given file does not exist. + `FileException` if the given file does not exist. +/ void setAttributes(in char[] name, uint attributes) @safe { @@ -1140,7 +1140,7 @@ void setAttributes(in char[] name, uint attributes) @safe name = The path to the file. Throws: - $(D FileException) if the given file does not exist. + `FileException` if the given file does not exist. Examples: -------------------- @@ -1242,22 +1242,22 @@ bool attrIsDir(uint attributes) @safe pure nothrow @nogc Returns whether the given file (or directory) is a file. On Windows, if a file is not a directory, then it's a file. So, - either $(D isFile) or $(D isDir) will return true for any given file. + either `isFile` or `isDir` will return true for any given file. - On Posix systems, if $(D isFile) is $(D true), that indicates that the file + On Posix systems, if `isFile` is `true`, that indicates that the file is a regular file (e.g. not a block not device). So, on Posix systems, it's - possible for both $(D isFile) and $(D isDir) to be $(D false) for a + possible for both `isFile` and `isDir` to be `false` for a particular file (in which case, it's a special file). You can use - $(D getAttributes) to get the attributes to figure out what type of special - it is, or you can use $(D DirEntry) to get at its $(D statBuf), which is the - result from $(D stat). In either case, see the man page for $(D stat) for + `getAttributes` to get the attributes to figure out what type of special + it is, or you can use `DirEntry` to get at its `statBuf`, which is the + result from `stat`. In either case, see the man page for `stat` for more information. Params: name = The path to the file. Throws: - $(D FileException) if the given file does not exist. + `FileException` if the given file does not exist. Examples: -------------------- @@ -1298,15 +1298,15 @@ assert(!"/usr/share/include".isFile); Returns whether the given file attributes are for a file. On Windows, if a file is not a directory, it's a file. So, either - $(D attrIsFile) or $(D attrIsDir) will return $(D true) for the + `attrIsFile` or `attrIsDir` will return `true` for the attributes of any given file. - On Posix systems, if $(D attrIsFile) is $(D true), that indicates that the + On Posix systems, if `attrIsFile` is `true`, that indicates that the file is a regular file (e.g. not a block not device). So, on Posix systems, - it's possible for both $(D attrIsFile) and $(D attrIsDir) to be $(D false) + it's possible for both `attrIsFile` and `attrIsDir` to be `false` for a particular file (in which case, it's a special file). If a file is a special file, you can use the attributes to check what type of special file - it is (see the man page for $(D stat) for more information). + it is (see the man page for `stat` for more information). Params: attributes = The file attributes. @@ -1365,14 +1365,14 @@ bool attrIsFile(uint attributes) @safe pure nothrow @nogc /++ Returns whether the given file is a symbolic link. - On Windows, returns $(D true) when the file is either a symbolic link or a + On Windows, returns `true` when the file is either a symbolic link or a junction point. Params: name = The path to the file. Throws: - $(D FileException) if the given file does not exist. + `FileException` if the given file does not exist. +/ @property bool isSymlink(in char[] name) @safe { @@ -1459,7 +1459,7 @@ unittest /++ Returns whether the given file attributes are for a symbolic link. - On Windows, return $(D true) when the file is either a symbolic link or a + On Windows, return `true` when the file is either a symbolic link or a junction point. Params: @@ -1483,8 +1483,8 @@ bool attrIsSymlink(uint attributes) @safe pure nothrow @nogc /**************************************************** - * Change directory to $(D pathname). - * Throws: $(D FileException) on error. + * Change directory to `pathname`. + * Throws: `FileException` on error. */ void chdir(in char[] pathname) @safe { @@ -1507,9 +1507,9 @@ void chdir(in char[] pathname) @safe } /**************************************************** -Make directory $(D pathname). +Make directory `pathname`. -Throws: $(D FileException) on Posix or $(D WindowsException) on Windows +Throws: `FileException` on Posix or `WindowsException` on Windows if an error occured. */ void mkdir(in char[] pathname) @safe @@ -1556,7 +1556,7 @@ private bool ensureDirExists(in char[] pathname) /**************************************************** * Make directory and all parent directories as needed. * - * Throws: $(D FileException) on error. + * Throws: `FileException` on error. */ void mkdirRecurse(in char[] pathname) @@ -1617,9 +1617,9 @@ unittest } /**************************************************** -Remove directory $(D pathname). +Remove directory `pathname`. -Throws: $(D FileException) on error. +Throws: `FileException` on error. */ void rmdir(in char[] pathname) { @@ -1649,7 +1649,7 @@ void rmdir(in char[] pathname) not the files being linked to or from. Throws: - $(D FileException) on error (which includes if the symlink already + `FileException` on error (which includes if the symlink already exists). +/ version(StdDdoc) void symlink(C1, C2)(const(C1)[] original, const(C2)[] link) @safe; @@ -1716,7 +1716,7 @@ version(Posix) @safe unittest working directory. Throws: - $(D FileException) on error. + `FileException` on error. +/ version(StdDdoc) string readLink(C)(const(C)[] link) @safe; else version(Posix) string readLink(C)(const(C)[] link) @safe @@ -1779,7 +1779,7 @@ version(Posix) @safe unittest /**************************************************** * Get the current working directory. - * Throws: $(D FileException) on error. + * Throws: `FileException` on error. */ version(Windows) string getcwd() { @@ -1935,7 +1935,7 @@ version(StdDdoc) path = The file (or directory) to get a DirEntry for. Throws: - $(D FileException) if the file does not exist. + `FileException` if the file does not exist. +/ this(string path); @@ -1949,7 +1949,7 @@ version(StdDdoc) } /++ - Returns the path to the file represented by this $(D DirEntry). + Returns the path to the file represented by this `DirEntry`. Examples: -------------------- @@ -1964,7 +1964,7 @@ assert(de2.name == "/usr/share/include"); /++ - Returns whether the file represented by this $(D DirEntry) is a + Returns whether the file represented by this `DirEntry` is a directory. Examples: @@ -1980,16 +1980,16 @@ assert(de2.isDir); /++ - Returns whether the file represented by this $(D DirEntry) is a file. + Returns whether the file represented by this `DirEntry` is a file. On Windows, if a file is not a directory, then it's a file. So, - either $(D isFile) or $(D isDir) will return $(D true). + either `isFile` or `isDir` will return `true`. - On Posix systems, if $(D isFile) is $(D true), that indicates that + On Posix systems, if `isFile` is `true`, that indicates that the file is a regular file (e.g. not a block not device). So, on - Posix systems, it's possible for both $(D isFile) and $(D isDir) to - be $(D false) for a particular file (in which case, it's a special - file). You can use $(D attributes) or $(D statBuf) to get more + Posix systems, it's possible for both `isFile` and `isDir` to + be `false` for a particular file (in which case, it's a special + file). You can use `attributes` or `statBuf` to get more information about a special file (see the stat man page for more details). @@ -2005,16 +2005,16 @@ assert(!de2.isFile); @property bool isFile(); /++ - Returns whether the file represented by this $(D DirEntry) is a + Returns whether the file represented by this `DirEntry` is a symbolic link. - On Windows, return $(D true) when the file is either a symbolic + On Windows, return `true` when the file is either a symbolic link or a junction point. +/ @property bool isSymlink(); /++ - Returns the size of the the file represented by this $(D DirEntry) + Returns the size of the the file represented by this `DirEntry` in bytes. +/ @property ulong size(); @@ -2023,50 +2023,50 @@ assert(!de2.isFile); $(BLUE This function is Windows-Only.) Returns the creation time of the file represented by this - $(D DirEntry). + `DirEntry`. +/ @property SysTime timeCreated() const; /++ - Returns the time that the file represented by this $(D DirEntry) was + Returns the time that the file represented by this `DirEntry` was last accessed. Note that many file systems do not update the access time for files (generally for performance reasons), so there's a good chance that - $(D timeLastAccessed) will return the same value as - $(D timeLastModified). + `timeLastAccessed` will return the same value as + `timeLastModified`. +/ @property SysTime timeLastAccessed(); /++ - Returns the time that the file represented by this $(D DirEntry) was + Returns the time that the file represented by this `DirEntry` was last modified. +/ @property SysTime timeLastModified(); /++ - Returns the attributes of the file represented by this $(D DirEntry). + Returns the attributes of the file represented by this `DirEntry`. Note that the file attributes on Windows and Posix systems are completely different. On, Windows, they're what is returned by - $(D GetFileAttributes) + `GetFileAttributes` $(WEB msdn.microsoft.com/en-us/library/aa364944(v=vs.85).aspx, GetFileAttributes) Whereas, an Posix systems, they're the $(D st_mode) value which is - part of the $(D stat) struct gotten by calling $(D stat). + part of the `stat` struct gotten by calling `stat`. - On Posix systems, if the file represented by this $(D DirEntry) is a + On Posix systems, if the file represented by this `DirEntry` is a symbolic link, then attributes are the attributes of the file pointed to by the symbolic link. +/ @property uint attributes(); /++ - On Posix systems, if the file represented by this $(D DirEntry) is a - symbolic link, then $(D linkAttributes) are the attributes of the - symbolic link itself. Otherwise, $(D linkAttributes) is identical to - $(D attributes). + On Posix systems, if the file represented by this `DirEntry` is a + symbolic link, then `linkAttributes` are the attributes of the + symbolic link itself. Otherwise, `linkAttributes` is identical to + `attributes`. - On Windows, $(D linkAttributes) is identical to $(D attributes). It + On Windows, `linkAttributes` is identical to `attributes`. It exists on Windows so that you don't have to special-case code for Windows when dealing with symbolic links. +/ @@ -2078,7 +2078,7 @@ assert(!de2.isFile); /++ $(BLUE This function is Posix-Only.) - The $(D stat) struct gotten from calling $(D stat). + The `stat` struct gotten from calling `stat`. +/ @property stat_t statBuf(); } @@ -2486,12 +2486,12 @@ else } /*************************************************** -Copy file $(D from) to file $(D to). File timestamps are preserved. -File attributes are preserved, if $(D preserve) equals $(D PreserveAttributes.yes). -On Windows only $(D PreserveAttributes.yes) (the default on Windows) is supported. +Copy file `from` to file `to`. File timestamps are preserved. +File attributes are preserved, if `preserve` equals `PreserveAttributes.yes`. +On Windows only `PreserveAttributes.yes` (the default on Windows) is supported. If the target file exists, it is overwritten. -Throws: $(D FileException) on error. +Throws: `FileException` on error. */ void copy(in char[] from, in char[] to, PreserveAttributes preserve = preserveAttributesDefault) { @@ -2583,7 +2583,7 @@ version(Posix) unittest //issue 11434 recursively. Throws: - $(D FileException) if there is an error (including if the given + `FileException` if there is an error (including if the given file is not a directory). +/ void rmdirRecurse(in char[] pathname) @@ -2598,7 +2598,7 @@ void rmdirRecurse(in char[] pathname) recursively. Throws: - $(D FileException) if there is an error (including if the given + `FileException` if there is an error (including if the given file is not a directory). +/ void rmdirRecurse(ref DirEntry de) @@ -2946,7 +2946,7 @@ public: iterated over. Throws: - $(D FileException) if the directory does not exist. + `FileException` if the directory does not exist. Examples: -------------------- @@ -3059,7 +3059,7 @@ unittest iterated over. Throws: - $(D FileException) if the directory does not exist. + `FileException` if the directory does not exist. Examples: -------------------- @@ -3295,7 +3295,7 @@ auto a = slurp!(int, double)("filename", "%s, %s"); ---- Bugs: -$(D slurp) expects file names to be encoded in $(B CP_ACP) on $(I Windows) +`slurp` expects file names to be encoded in $(B CP_ACP) on $(I Windows) instead of UTF-8 (as it internally uses $(XREF stdio, File), see $(BUGZILLA 7648)) thus must not be used in $(I Windows) or cross-platform applications other than with an immediate ASCII string as @@ -3340,20 +3340,20 @@ unittest Returns the path to a directory for temporary files. On Windows, this function returns the result of calling the Windows API function -$(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992.aspx, $(D GetTempPath)). +$(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992.aspx, `GetTempPath`). On POSIX platforms, it searches through the following list of directories and returns the first one which is found to exist: $(OL - $(LI The directory given by the $(D TMPDIR) environment variable.) - $(LI The directory given by the $(D TEMP) environment variable.) - $(LI The directory given by the $(D TMP) environment variable.) - $(LI $(D /tmp)) - $(LI $(D /var/tmp)) - $(LI $(D /usr/tmp)) + $(LI The directory given by the `TMPDIR` environment variable.) + $(LI The directory given by the `TEMP` environment variable.) + $(LI The directory given by the `TMP` environment variable.) + $(LI `/tmp`) + $(LI `/var/tmp`) + $(LI `/usr/tmp`) ) -On all platforms, $(D tempDir) returns $(D ".") on failure, representing +On all platforms, `tempDir` returns `"."` on failure, representing the current working directory. The return value of the function is cached, so the procedures described @@ -3362,8 +3362,8 @@ subsequent runs will return the same string, regardless of whether environment variables and directory structures have changed in the meantime. -The POSIX $(D tempDir) algorithm is inspired by Python's -$(LINK2 http://docs.python.org/library/tempfile.html#tempfile.tempdir, $(D tempfile.tempdir)). +The POSIX `tempDir` algorithm is inspired by Python's +$(LINK2 http://docs.python.org/library/tempfile.html#tempfile.tempdir, `tempfile.tempdir`). */ string tempDir() @trusted { diff --git a/std/format.d b/std/format.d index 209a0d998ff..8fa2ca43654 100644 --- a/std/format.d +++ b/std/format.d @@ -2,7 +2,7 @@ /** This module implements the formatting functionality for strings and - I/O. It's comparable to C99's $(D vsprintf()) and uses a similar + I/O. It's comparable to C99's `vsprintf()` and uses a similar format encoding scheme. For an introductory look at $(B std.format)'s capabilities and how to use @@ -68,19 +68,19 @@ private alias enforceFmt = enforceEx!FormatException; /********************************************************************** - Interprets variadic argument list $(D args), formats them according - to $(D fmt), and sends the resulting characters to $(D w). The - encoding of the output is the same as $(D Char). The type $(D Writer) + Interprets variadic argument list `args`, formats them according + to `fmt`, and sends the resulting characters to `w`. The + encoding of the output is the same as `Char`. The type `Writer` must satisfy $(XREF range,isOutputRange!(Writer, Char)). The variadic arguments are normally consumed in order. POSIX-style $(WEB opengroup.org/onlinepubs/009695399/functions/printf.html, positional parameter syntax) is also supported. Each argument is formatted into a sequence of chars according to the format - specification, and the characters are passed to $(D w). As many + specification, and the characters are passed to `w`. As many arguments as specified in the format string are consumed and formatted. If there are fewer arguments than format specifiers, a - $(D FormatException) is thrown. If there are more remaining arguments + `FormatException` is thrown. If there are more remaining arguments than needed by the format specification, they are ignored but only if at least one argument was formatted. @@ -176,7 +176,7 @@ $(I FormatChar): $(TR $(TD $(B '0')) $(TD numeric) $(TD Use leading zeros to pad rather than spaces (except for the floating point - values $(D nan) and $(D infinity)). Ignore if there's a $(I + values `nan` and `infinity`). Ignore if there's a $(I Precision).)) $(TR $(TD $(B ' ')) $(TD numeric) $(TD Prefix positive @@ -530,8 +530,8 @@ uint formattedWrite(Writer, Char, A...)(Writer w, in Char[] fmt, A args) } /** -Reads characters from input range $(D r), converts them according -to $(D fmt), and writes them to $(D args). +Reads characters from input range `r`, converts them according +to `fmt`, and writes them to `args`. Params: r = The range to read from. @@ -623,7 +623,7 @@ template FormatSpec(Char) } /** - * A General handler for $(D printf) style format specifiers. Used for building more + * A General handler for `printf` style format specifiers. Used for building more * specific formatting functions. */ struct FormatSpec(Char) @@ -634,7 +634,7 @@ struct FormatSpec(Char) import std.conv : parse, text, to; /** - Minimum _width, default $(D 0). + Minimum _width, default `0`. */ int width = 0; @@ -646,8 +646,8 @@ struct FormatSpec(Char) int precision = UNSPECIFIED; /** - Special value for width and precision. $(D DYNAMIC) width or - precision means that they were specified with $(D '*') in the + Special value for width and precision. `DYNAMIC` width or + precision means that they were specified with `'*'` in the format string and are passed at runtime through the varargs. */ enum int DYNAMIC = int.max; @@ -659,50 +659,50 @@ struct FormatSpec(Char) enum int UNSPECIFIED = DYNAMIC - 1; /** - The actual format specifier, $(D 's') by default. + The actual format specifier, `'s'` by default. */ char spec = 's'; /** - Index of the argument for positional parameters, from $(D 1) to - $(D ubyte.max). ($(D 0) means not used). + Index of the argument for positional parameters, from `1` to + `ubyte.max`. (`0` means not used). */ ubyte indexStart; /** Index of the last argument for positional parameter range, from - $(D 1) to $(D ubyte.max). ($(D 0) means not used). + `1` to `ubyte.max`. (`0` means not used). */ ubyte indexEnd; version(StdDdoc) { /** - The format specifier contained a $(D '-') ($(D printf) + The format specifier contained a `'-'` (`printf` compatibility). */ bool flDash; /** - The format specifier contained a $(D '0') ($(D printf) + The format specifier contained a `'0'` (`printf` compatibility). */ bool flZero; /** - The format specifier contained a $(D ' ') ($(D printf) + The format specifier contained a $(D ' ') (`printf` compatibility). */ bool flSpace; /** - The format specifier contained a $(D '+') ($(D printf) + The format specifier contained a `'+'` (`printf` compatibility). */ bool flPlus; /** - The format specifier contained a $(D '#') ($(D printf) + The format specifier contained a `'#'` (`printf` compatibility). */ bool flHash; @@ -735,7 +735,7 @@ struct FormatSpec(Char) /** In case of a compound format specifier, $(D _sep) contains the - string positioning after $(D "%|"). + string positioning after `"%|"`. */ const(Char)[] sep; @@ -746,19 +746,19 @@ struct FormatSpec(Char) /* This string is inserted before each sequence (e.g. array) - formatted (by default $(D "[")). + formatted (by default `"["`). */ enum immutable(Char)[] seqBefore = "["; /* This string is inserted after each sequence formatted (by - default $(D "]")). + default `"]"`). */ enum immutable(Char)[] seqAfter = "]"; /* This string is inserted after each element keys of a sequence (by - default $(D ":")). + default `":"`). */ enum immutable(Char)[] keySeparator = ":"; @@ -769,7 +769,7 @@ struct FormatSpec(Char) enum immutable(Char)[] seqSeparator = ", "; /** - Construct a new $(D FormatSpec) using the format string $(D fmt), no + Construct a new `FormatSpec` using the format string `fmt`, no processing is done until needed. */ this(in Char[] fmt) @safe pure @@ -1201,14 +1201,14 @@ struct FormatSpec(Char) } /** -Helper function that returns a $(D FormatSpec) for a single specifier given -in $(D fmt) +Helper function that returns a `FormatSpec` for a single specifier given +in `fmt` Params: fmt = A format specifier Returns: - A $(D FormatSpec) with the specifier parsed. + A `FormatSpec` with the specifier parsed. Enforces giving only one specifier to the function. */ @@ -1248,13 +1248,13 @@ unittest } /** -$(D bool)s are formatted as "true" or "false" with %s and as "1" or +`bool`s are formatted as "true" or "false" with %s and as "1" or "0" with integral-specific format specs. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(BooleanTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -1331,12 +1331,12 @@ unittest } /** -$(D null) literal is formatted as $(D "null"). +`null` literal is formatted as `"null"`. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(Unqual!T == typeof(null)) && !is(T == enum) && !hasToString!(T, Char)) @@ -1367,12 +1367,12 @@ unittest } /** -Integrals are formatted like $(D printf) does. +Integrals are formatted like `printf` does. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(IntegralTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -1612,12 +1612,12 @@ unittest } /** -Floating-point values are formatted like $(D printf) does. +Floating-point values are formatted like `printf` does. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(FloatingPointTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -1766,12 +1766,12 @@ unittest } /* -Formatting a $(D creal) is deprecated but still kept around for a while. +Formatting a `creal` is deprecated but still kept around for a while. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(Unqual!T : creal) && !is(T == enum) && !hasToString!(T, Char)) @@ -1822,12 +1822,12 @@ unittest } /* - Formatting an $(D ireal) is deprecated but still kept around for a while. + Formatting an `ireal` is deprecated but still kept around for a while. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(Unqual!T : ireal) && !is(T == enum) && !hasToString!(T, Char)) @@ -1867,14 +1867,14 @@ unittest } /** -Individual characters ($(D char), $(D wchar), or $(D dchar)) are formatted as +Individual characters (`char`, `wchar`, or `dchar`) are formatted as Unicode characters with %s and as integers with integral-specific format specs. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(CharTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -1942,12 +1942,12 @@ unittest } /** -Strings are formatted like $(D printf) does. +Strings are formatted like `printf` does. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(StringTypeOf!T) && !is(StaticArrayTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -2021,9 +2021,9 @@ unittest Static-size arrays are formatted as dynamic arrays. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, auto ref T obj, ref FormatSpec!Char f) if (is(StaticArrayTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -2060,13 +2060,13 @@ unittest // Test for issue 8310 Dynamic arrays are formatted as input ranges. Specializations: - $(UL $(LI $(D void[]) is formatted like $(D ubyte[]).) + $(UL $(LI `void[]` is formatted like `ubyte[]`.) $(LI Const array is converted to input range by removing its qualifier.)) Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(DynamicArrayTypeOf!T) && !is(StringTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -2600,13 +2600,13 @@ if (!is(StringTypeOf!T) && !is(CharTypeOf!T) || is(T == enum)) } /** - Associative arrays are formatted by using $(D ':') and $(D ", ") as - separators, and enclosed by $(D '[') and $(D ']'). + Associative arrays are formatted by using `':'` and $(D ", ") as + separators, and enclosed by `'['` and `']'`. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. obj = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T obj, ref FormatSpec!Char f) if (is(AssocArrayTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) @@ -2828,9 +2828,9 @@ unittest } /** - Aggregates ($(D struct), $(D union), $(D class), and $(D interface)) are - basically formatted by calling $(D toString). - $(D toString) should have one of the following signatures: + Aggregates (`struct`, `union`, `class`, and `interface`) are + basically formatted by calling `toString`. + `toString` should have one of the following signatures: --- const void toString(scope void delegate(const(char)[]) sink, FormatSpec fmt); @@ -2840,11 +2840,11 @@ const string toString(); --- For the class objects which have input range interface, - $(UL $(LI If the instance $(D toString) has overridden - $(D Object.toString), it is used.) + $(UL $(LI If the instance `toString` has overridden + `Object.toString`, it is used.) $(LI Otherwise, the objects are formatted as input range.)) - For the struct and union objects which does not have $(D toString), + For the struct and union objects which does not have `toString`, $(UL $(LI If they have range interface, formatted as input range.) $(LI Otherwise, they are formatted like $(D Type(field1, filed2, ...)).)) @@ -2892,7 +2892,7 @@ if (is(T == class) && !is(T == enum)) } /++ - $(D formatValue) allows to reuse existing format specifiers: + `formatValue` allows to reuse existing format specifiers: +/ unittest { @@ -2919,7 +2919,7 @@ unittest } /++ - The following code compares the use of $(D formatValue) and $(D formattedWrite). + The following code compares the use of `formatValue` and `formattedWrite`. +/ unittest { @@ -3207,12 +3207,12 @@ unittest } /** -$(D enum) is formatted like its base value. +`enum` is formatted like its base value. Params: - w = The $(D OutputRange) to write to. + w = The `OutputRange` to write to. val = The value to write. - f = The $(D FormatSpec) defining how to write the value. + f = The `FormatSpec` defining how to write the value. */ void formatValue(Writer, T, Char)(Writer w, T val, ref FormatSpec!Char f) if (is(T == enum)) @@ -5006,22 +5006,22 @@ private TypeInfo primitiveTypeInfo(Mangle m) * The variadic arguments are consumed in order. Each is formatted * into a sequence of chars, using the default format specification * for its type, and the characters are sequentially passed to putc. - * If a $(D char[]), $(D wchar[]), or $(D dchar[]) argument is + * If a `char[]`, `wchar[]`, or `dchar[]` argument is * encountered, it is interpreted as a format string. As many * arguments as specified in the format string are consumed and * formatted according to the format specifications in that string and * passed to putc. If there are too few remaining arguments, a - * $(D FormatException) is thrown. If there are more remaining arguments than + * `FormatException` is thrown. If there are more remaining arguments than * needed by the format specification, the default processing of * arguments resumes until they are all consumed. * * Params: * putc = Output is sent do this delegate, character by character. - * arguments = Array of $(D TypeInfo)s, one for each argument to be formatted. + * arguments = Array of `TypeInfo`s, one for each argument to be formatted. * argptr = Points to variadic argument list. * * Throws: - * Mismatched arguments and formats result in a $(D FormatException) being thrown. + * Mismatched arguments and formats result in a `FormatException` being thrown. * * Format_String: * $(I Format strings) @@ -6594,7 +6594,7 @@ unittest /***************************************************** * Format arguments into buffer buf which must be large * enough to hold the result. Throws RangeError if it is not. - * Returns: The slice of $(D buf) containing the formatted string. + * Returns: The slice of `buf` containing the formatted string. * * $(RED sformat's current implementation has been replaced with $(LREF xsformat)'s * implementation. in November 2012. diff --git a/std/functional.d b/std/functional.d index 53411d5459a..4c334ce4986 100644 --- a/std/functional.d +++ b/std/functional.d @@ -54,9 +54,9 @@ private template needOpCallAlias(alias fun) /** Transforms a string representing an expression into a unary -function. The string must either use symbol name $(D a) as -the parameter or provide the symbol via the $(D parmName) argument. -If $(D fun) is not a string, $(D unaryFun) aliases itself away to $(D fun). +function. The string must either use symbol name `a` as +the parameter or provide the symbol via the `parmName` argument. +If `fun` is not a string, `unaryFun` aliases itself away to `fun`. */ template unaryFun(alias fun, string parmName = "a") @@ -144,10 +144,10 @@ unittest /** Transforms a string representing an expression into a binary function. The -string must either use symbol names $(D a) and $(D b) as the parameters or -provide the symbols via the $(D parm1Name) and $(D parm2Name) arguments. -If $(D fun) is not a string, $(D binaryFun) aliases itself away to -$(D fun). +string must either use symbol names `a` and `b` as the parameters or +provide the symbols via the `parm1Name` and `parm2Name` arguments. +If `fun` is not a string, `binaryFun` aliases itself away to +`fun`. */ template binaryFun(alias fun, string parm1Name = "a", @@ -268,7 +268,7 @@ private uint _ctfeSkipName(ref string op, string name) return 0; } -// returns 1 if $(D fun) is trivial unary function +// returns 1 if `fun` is trivial unary function private uint _ctfeMatchUnary(string fun, string name) { if (!__ctfe) assert(false); @@ -316,7 +316,7 @@ unittest static assert(_ctfeMatchUnary("ё[21]", "ё")); } -// returns 1 if $(D fun) is trivial binary function +// returns 1 if `fun` is trivial binary function private uint _ctfeMatchBinary(string fun, string name1, string name2) { if (!__ctfe) assert(false); @@ -554,7 +554,7 @@ unittest } /** -Negates predicate $(D pred). +Negates predicate `pred`. */ template not(alias pred) { @@ -643,7 +643,7 @@ template partial(alias fun, alias arg) } /** -Deprecated alias for $(D partial), kept for backwards compatibility +Deprecated alias for `partial`, kept for backwards compatibility */ deprecated("Please use std.functional.partial instead") @@ -749,7 +749,7 @@ functions. Note: In the special case where where only a single function is provided ($(D F.length == 1)), adjoin simply aliases to the single passed function -($(D F[0])). +(`F[0]`). */ template adjoin(F...) if (F.length == 1) { @@ -875,7 +875,7 @@ unittest /** Composes passed-in functions $(D fun[0], fun[1], ...) returning a - function $(D f(x)) that in turn returns $(D + function `f(x)` that in turn returns $(D fun[0](fun[1](...(x)))...). Each function can be a regular functions, a delegate, or a string. @@ -970,8 +970,8 @@ unittest } ---- -Technically the memoized function should be pure because $(D memoize) assumes it will -always return the same result for a given tuple of arguments. However, $(D memoize) does not +Technically the memoized function should be pure because `memoize` assumes it will +always return the same result for a given tuple of arguments. However, `memoize` does not enforce that because sometimes it is useful to memoize an impure function, too. */ @@ -1072,8 +1072,8 @@ unittest } /** - * This memoizes all values of $(D fact) up to the largest argument. To only cache the final - * result, move $(D memoize) outside the function as shown below. + * This memoizes all values of `fact` up to the largest argument. To only cache the final + * result, move `memoize` outside the function as shown below. */ unittest { @@ -1086,7 +1086,7 @@ unittest } /** - * When the $(D maxSize) parameter is specified, memoize will used + * When the `maxSize` parameter is specified, memoize will used * a fixed size hash table to limit the number of cached entries. */ unittest @@ -1222,7 +1222,7 @@ private struct DelegateFaker(F) * * BUGS: * $(UL - * $(LI Does not work with $(D @safe) functions.) + * $(LI Does not work with `@safe` functions.) * $(LI Ignores C-style / D-style variadic arguments.) * ) */ diff --git a/std/getopt.d b/std/getopt.d index 913ef7f1fbf..c39623a95e5 100644 --- a/std/getopt.d +++ b/std/getopt.d @@ -3,7 +3,7 @@ /** Processing of command line options. -The getopt module implements a $(D getopt) function, which adheres to +The getopt module implements a `getopt` function, which adheres to the POSIX syntax for command line options. GNU extensions are supported in the form of long options introduced by a double dash ("--"). Support for bundling of command line options, as was the case @@ -19,7 +19,7 @@ License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: $(WEB erdani.org, Andrei Alexandrescu) Credits: This module and its documentation are inspired by Perl's $(WEB perldoc.perl.org/Getopt/Long.html, Getopt::Long) module. The syntax of - D's $(D getopt) is simpler than its Perl counterpart because $(D + D's `getopt` is simpler than its Perl counterpart because $(D getopt) infers the expected parameter types from the static types of the passed-in pointers. Source: $(PHOBOSSRC std/_getopt.d) @@ -37,7 +37,7 @@ import std.traits; /** * Thrown on one of the following conditions: * - An unrecognized command-line argument is passed - * and $(D std.getopt.config.passThrough) was not present. + * and `std.getopt.config.passThrough` was not present. */ class GetOptException : Exception { @@ -80,31 +80,31 @@ void main(string[] args) } --------- - The $(D getopt) function takes a reference to the command line - (as received by $(D main)) as its first argument, and an + The `getopt` function takes a reference to the command line + (as received by `main`) as its first argument, and an unbounded number of pairs of strings and pointers. Each string is an option meant to "fill" the value pointed-to by the pointer to its right (the "bound" pointer). The option string in the call to - $(D getopt) should not start with a dash. + `getopt` should not start with a dash. In all cases, the command-line options that were parsed and used by - $(D getopt) are removed from $(D args). Whatever in the - arguments did not look like an option is left in $(D args) for + `getopt` are removed from `args`. Whatever in the + arguments did not look like an option is left in `args` for further processing by the program. Values that were unaffected by the options are not touched, so a common idiom is to initialize options - to their defaults and then invoke $(D getopt). If a + to their defaults and then invoke `getopt`. If a command-line argument is recognized as an option with a parameter and the parameter cannot be parsed properly (e.g. a number is expected - but not present), a $(D ConvException) exception is thrown. - If $(D std.getopt.config.passThrough) was not passed to getopt - and an unrecognized command-line argument is found, a $(D GetOptException) + but not present), a `ConvException` exception is thrown. + If `std.getopt.config.passThrough` was not passed to getopt + and an unrecognized command-line argument is found, a `GetOptException` is thrown. - Depending on the type of the pointer being bound, $(D getopt) + Depending on the type of the pointer being bound, `getopt` recognizes the following kinds of options: $(OL - $(LI $(I Boolean options). A lone argument sets the option to $(D true). + $(LI $(I Boolean options). A lone argument sets the option to `true`. Additionally $(B true) or $(B false) can be set within the option separated with an "=" sign: @@ -113,11 +113,11 @@ void main(string[] args) getopt(args, "verbose", &verbose, "debug", &debugging); --------- - To set $(D verbose) to $(D true), invoke the program with either - $(D --verbose) or $(D --verbose=true). + To set `verbose` to `true`, invoke the program with either + `--verbose` or `--verbose=true`. - To set $(D debugging) to $(D false), invoke the program with - $(D --debugging=false). + To set `debugging` to `false`, invoke the program with + `--debugging=false`. ) $(LI $(I Numeric options.) If an option is bound to a numeric type, a @@ -129,8 +129,8 @@ void main(string[] args) getopt(args, "timeout", &timeout); --------- - To set $(D timeout) to $(D 5), invoke the program with either - $(D --timeout=5) or $(D --timeout 5). + To set `timeout` to `5`, invoke the program with either + `--timeout=5` or $(D --timeout 5). ) $(LI $(I Incremental options.) If an option name has a "+" suffix and is @@ -145,7 +145,7 @@ void main(string[] args) Invoking the program with "--paranoid --paranoid --paranoid" will set $(D paranoid) to 3. Note that an incremental option never expects a parameter, e.g. in the command line "--paranoid 42 --paranoid", the "42" does not set - $(D paranoid) to 42; instead, $(D paranoid) is set to 2 and "42" is not + `paranoid` to 42; instead, `paranoid` is set to 2 and "42" is not considered as part of the normal program arguments. ) @@ -159,8 +159,8 @@ void main(string[] args) getopt(args, "color", &color); --------- - To set $(D color) to $(D Color.yes), invoke the program with either - $(D --color=yes) or $(D --color yes). + To set `color` to `Color.yes`, invoke the program with either + `--color=yes` or $(D --color yes). ) $(LI $(I String options.) If an option is bound to a string, a string is @@ -173,7 +173,7 @@ getopt(args, "output", &outputFile); --------- Invoking the program with "--output=myfile.txt" or "--output myfile.txt" - will set $(D outputFile) to "myfile.txt". If you want to pass a string + will set `outputFile` to "myfile.txt". If you want to pass a string containing spaces, you need to use the quoting that is appropriate to your shell, e.g. --output='my file.txt'. ) @@ -187,7 +187,7 @@ getopt(args, "output", &outputFiles); --------- Invoking the program with "--output=myfile.txt --output=yourfile.txt" or - "--output myfile.txt --output yourfile.txt" will set $(D outputFiles) to + "--output myfile.txt --output yourfile.txt" will set `outputFiles` to $(D [ "myfile.txt", "yourfile.txt" ]). Alternatively you can set $(LREF arraySep) as the element separator: @@ -211,7 +211,7 @@ getopt(args, "tune", &tuningParms); --------- Invoking the program with e.g. "--tune=alpha=0.5 --tune beta=0.6" will set - $(D tuningParms) to [ "alpha" : 0.5, "beta" : 0.6 ]. + `tuningParms` to [ "alpha" : 0.5, "beta" : 0.6 ]. Alternatively you can set $(LREF arraySep) as the element separator: @@ -309,7 +309,7 @@ getopt(args, "verbose|loquacious|garrulous", &verbose); $(B Case) By default options are case-insensitive. You can change that behavior -by passing $(D getopt) the $(D caseSensitive) directive like this: +by passing `getopt` the `caseSensitive` directive like this: --------- bool foo, bar; @@ -320,8 +320,8 @@ getopt(args, --------- In the example above, "--foo", "--bar", "--FOo", "--bAr" etc. are recognized. -The directive is active til the end of $(D getopt), or until the -converse directive $(D caseInsensitive) is encountered: +The directive is active til the end of `getopt`, or until the +converse directive `caseInsensitive` is encountered: --------- bool foo, bar; @@ -341,8 +341,8 @@ option "bar" was parsed. $(B "Short" versus "long" options) Traditionally, programs accepted single-letter options preceded by -only one dash (e.g. $(D -t)). $(D getopt) accepts such parameters -seamlessly. When used with a double-dash (e.g. $(D --t)), a +only one dash (e.g. `-t`). `getopt` accepts such parameters +seamlessly. When used with a double-dash (e.g. `--t`), a single-letter option behaves the same as a multi-letter option. When used with a single dash, a single-letter option is accepted. If the option has a parameter, that must be "stuck" to the option without @@ -353,9 +353,9 @@ uint timeout; getopt(args, "timeout|t", &timeout); --------- -To set $(D timeout) to $(D 5), use either of the following: $(D --timeout=5), -$(D --timeout 5), $(D --t=5), $(D --t 5), or $(D -t5). Forms such as $(D -t 5) -and $(D -timeout=5) will be not accepted. +To set `timeout` to `5`, use either of the following: `--timeout=5`, +$(D --timeout 5), `--t=5`, $(D --t 5), or `-t5`. Forms such as $(D -t 5) +and `-timeout=5` will be not accepted. For more details about short options, refer also to the next section. @@ -363,7 +363,7 @@ $(B Bundling) Single-letter options can be bundled together, i.e. "-abc" is the same as $(D "-a -b -c"). By default, this option is turned off. You can turn it on -with the $(D std.getopt.config.bundling) directive: +with the `std.getopt.config.bundling` directive: --------- bool foo, bar; @@ -374,7 +374,7 @@ getopt(args, --------- In case you want to only enable bundling for some of the parameters, -bundling can be turned off with $(D std.getopt.config.noBundling). +bundling can be turned off with `std.getopt.config.noBundling`. $(B Required) @@ -389,14 +389,14 @@ getopt(args, "bar|b", &bar); --------- -Only the option direclty following $(D std.getopt.config.required) is +Only the option direclty following `std.getopt.config.required` is required. $(B Passing unrecognized options through) If an application needs to do its own processing of whichever arguments -$(D getopt) did not understand, it can pass the -$(D std.getopt.config.passThrough) directive to $(D getopt): +`getopt` did not understand, it can pass the +`std.getopt.config.passThrough` directive to `getopt`: --------- bool foo, bar; @@ -407,22 +407,22 @@ getopt(args, --------- An unrecognized option such as "--baz" will be found untouched in -$(D args) after $(D getopt) returns. +`args` after `getopt` returns. $(D Help Information Generation) If an option string is followed by another string, this string serves as an -description for this option. The function $(D getopt) returns a struct of type -$(D GetoptResult). This return value contains information about all passed options +description for this option. The function `getopt` returns a struct of type +`GetoptResult`. This return value contains information about all passed options as well a bool indicating if information about these options where required by the passed arguments. $(B Options Terminator) -A lonesome double-dash terminates $(D getopt) gathering. It is used to +A lonesome double-dash terminates `getopt` gathering. It is used to separate program options from other parameters (e.g. options to be passed to another program). Invoking the example above with $(D "--foo -- --bar") -parses foo but leaves "--bar" in $(D args). The double-dash itself is +parses foo but leaves "--bar" in `args`. The double-dash itself is removed from the argument array. */ GetoptResult getopt(T...)(ref string[] args, T opts) @@ -456,9 +456,9 @@ unittest } /** - Configuration options for $(D getopt). + Configuration options for `getopt`. - You can pass them to $(D getopt) in any position, except in between an option + You can pass them to `getopt` in any position, except in between an option string and its bound pointer. */ enum config { @@ -480,18 +480,18 @@ enum config { required } -/** The result of the $(D getopt) function. +/** The result of the `getopt` function. -The $(D GetoptResult) contains two members. The first member is a boolean with -the name $(D helpWanted). The second member is an array of $(D Option). The -array is accessable by the name $(D options). +The `GetoptResult` contains two members. The first member is a boolean with +the name `helpWanted`. The second member is an array of `Option`. The +array is accessable by the name `options`. */ struct GetoptResult { bool helpWanted; /// Flag indicating if help was requested Option[] options; /// All possible options } -/** The result of the $(D getoptHelp) function. +/** The result of the `getoptHelp` function. */ struct Option { string optShort; /// The short symbol for this option @@ -850,22 +850,22 @@ unittest /** The option character (default '-'). - Defaults to '-' but it can be assigned to prior to calling $(D getopt). + Defaults to '-' but it can be assigned to prior to calling `getopt`. */ dchar optionChar = '-'; /** The string that conventionally marks the end of all options (default '--'). - Defaults to "--" but can be assigned to prior to calling $(D getopt). Assigning an - empty string to $(D endOfOptions) effectively disables it. + Defaults to "--" but can be assigned to prior to calling `getopt`. Assigning an + empty string to `endOfOptions` effectively disables it. */ string endOfOptions = "--"; /** The assignment character used in options with parameters (default '='). - Defaults to '=' but can be assigned to prior to calling $(D getopt). + Defaults to '=' but can be assigned to prior to calling `getopt`. */ dchar assignChar = '='; @@ -873,7 +873,7 @@ dchar assignChar = '='; The string used to separate the elements of an array or associative array (default is "" which means the elements are separated by whitespace). - Defaults to "" but can be assigned to prior to calling $(D getopt). + Defaults to "" but can be assigned to prior to calling `getopt`. */ string arraySep = ""; @@ -1345,13 +1345,13 @@ unittest assert(args == ["program", "--option"]); } -/** This function prints the passed $(D Option) and text in an aligned manner. +/** This function prints the passed `Option` and text in an aligned manner. The passed text will be printed first, followed by a newline. Than the short and long version of every option will be printed. The short and long version -will be aligned to the longest option of every $(D Option) passed. If a help +will be aligned to the longest option of every `Option` passed. If a help message is present it will be printed after the long version of the -$(D Option). +`Option`. ------------ foreach(it; opt) @@ -1363,7 +1363,7 @@ foreach(it; opt) Params: text = The text to printed at the beginning of the help output. - opt = The $(D Option) extracted from the $(D getopt) parameter. + opt = The `Option` extracted from the `getopt` parameter. */ void defaultGetoptPrinter(string text, Option[] opt) { @@ -1372,14 +1372,14 @@ void defaultGetoptPrinter(string text, Option[] opt) defaultGetoptFormatter(stdout.lockingTextWriter(), text, opt); } -/** This function writes the passed text and $(D Option) into an output range +/** This function writes the passed text and `Option` into an output range in the manner, described in the documentation of function -$(D defaultGetoptPrinter). +`defaultGetoptPrinter`. Params: output = The output range used to write the help information. text = The text to printed at the beginning of the help output. - opt = The $(D Option) extracted from the $(D getopt) parameter. + opt = The `Option` extracted from the `getopt` parameter. */ void defaultGetoptFormatter(Output)(Output output, string text, Option[] opt) { diff --git a/std/internal/cstring.d b/std/internal/cstring.d index 344210a402c..82e3e7aa14c 100644 --- a/std/internal/cstring.d +++ b/std/internal/cstring.d @@ -32,7 +32,7 @@ License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0). Authors: Denis Shelomovskij Macros: -COREREF = $(HTTP dlang.org/phobos/core_$1.html#$2, $(D core.$1.$2)) +COREREF = $(HTTP dlang.org/phobos/core_$1.html#$2, `core.$1.$2`) */ module std.internal.cstring; @@ -55,8 +55,8 @@ body Creates temporary $(I C string) with copy of passed text. Returned object is implicitly convertible to $(D const To*) and -has two properties: $(D ptr) to access $(I C string) as $(D const To*) -and $(D buffPtr) to access it as $(D To*). +has two properties: `ptr` to access $(I C string) as $(D const To*) +and `buffPtr` to access it as `To*`. The temporary $(I C string) is valid unless returned object is destroyed. Thus if returned object is assigned to a variable the temporary is @@ -67,7 +67,7 @@ primary expression. Implementation_note: For small strings tempCString will use stack allocated buffer, for large strings (approximately 250 characters and more) it will -allocate temporary one using C's $(D malloc). +allocate temporary one using C's `malloc`. Note: This function is intended to be used in function call expression (like @@ -211,13 +211,13 @@ pure nothrow @nogc unittest /** -Copies text from $(D source) to $(D buff) performing conversion +Copies text from `source` to `buff` performing conversion to different Unicode Transformation Format if needed. -$(D buff) must be large enough to hold the result. +`buff` must be large enough to hold the result. Returns: -Slice of the provided buffer $(D buff) with the copy of $(D source). +Slice of the provided buffer `buff` with the copy of `source`. */ To[] copyEncoded(To, From)(in From[] source, To[] buff) @trusted nothrow @nogc if(isSomeChar!To && isSomeChar!From) diff --git a/std/internal/scopebuffer.d b/std/internal/scopebuffer.d index 67323e25b85..13f0ee46a4f 100644 --- a/std/internal/scopebuffer.d +++ b/std/internal/scopebuffer.d @@ -74,11 +74,11 @@ string cat(string s1, string s2) return textbuf[].idup; } --- - * ScopeBuffer is intended for high performance usages in $(D @system) and $(D @trusted) code. + * ScopeBuffer is intended for high performance usages in `@system` and `@trusted` code. * It is designed to fit into two 64 bit registers, again for high performance use. * If used incorrectly, memory leaks and corruption can result. Be sure to use * $(D scope(exit) textbuf.free();) for proper cleanup, and do not refer to a ScopeBuffer - * instance's contents after $(D ScopeBuffer.free()) has been called. + * instance's contents after `ScopeBuffer.free()` has been called. * * The realloc parameter defaults to C's realloc(). Another can be supplied to override it. * @@ -175,8 +175,8 @@ struct ScopeBuffer(T, alias realloc = /*core.stdc.stdlib*/.realloc) /************************ * Append array s to the buffer. * - * If $(D const(T)) can be converted to $(D T), then put will accept - * $(D const(T)[]) as input. It will accept a $(D T[]) otherwise. + * If `const(T)` can be converted to `T`, then put will accept + * `const(T)[]` as input. It will accept a `T[]` otherwise. */ private alias CT = Select!(is(const(T) : T), const(T), T); /// ditto diff --git a/std/json.d b/std/json.d index a5579560553..ae5f298cead 100644 --- a/std/json.d +++ b/std/json.d @@ -63,7 +63,7 @@ JSON type enumeration */ enum JSON_TYPE : byte { - /// Indicates the type of a $(D JSONValue). + /// Indicates the type of a `JSONValue`. NULL, STRING, /// ditto INTEGER, /// ditto @@ -112,10 +112,10 @@ struct JSONValue /** $(RED Deprecated. Instead, please assign the value with the adequate - type to $(D JSONValue) directly. This will be removed in + type to `JSONValue` directly. This will be removed in June 2015.) - Sets the _type of this $(D JSONValue). Previous content is cleared. + Sets the _type of this `JSONValue`. Previous content is cleared. */ deprecated("Please assign the value with the adequate type to JSONValue directly.") @property JSON_TYPE type(JSON_TYPE newType) @@ -154,7 +154,7 @@ struct JSONValue } /// Value getter/setter for $(D JSON_TYPE.STRING). - /// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.STRING). + /// Throws `JSONException` for read access if `type` is not $(D JSON_TYPE.STRING). @property inout(string) str() inout { enforce!JSONException(type == JSON_TYPE.STRING, @@ -183,7 +183,7 @@ struct JSONValue } /// Value getter/setter for $(D JSON_TYPE.INTEGER). - /// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.INTEGER). + /// Throws `JSONException` for read access if `type` is not $(D JSON_TYPE.INTEGER). @property inout(long) integer() inout { enforce!JSONException(type == JSON_TYPE.INTEGER, @@ -198,7 +198,7 @@ struct JSONValue } /// Value getter/setter for $(D JSON_TYPE.UINTEGER). - /// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.UINTEGER). + /// Throws `JSONException` for read access if `type` is not $(D JSON_TYPE.UINTEGER). @property inout(ulong) uinteger() inout { enforce!JSONException(type == JSON_TYPE.UINTEGER, @@ -213,7 +213,7 @@ struct JSONValue } /// Value getter/setter for $(D JSON_TYPE.FLOAT). - /// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.FLOAT). + /// Throws `JSONException` for read access if `type` is not $(D JSON_TYPE.FLOAT). @property inout(double) floating() inout { enforce!JSONException(type == JSON_TYPE.FLOAT, @@ -228,7 +228,7 @@ struct JSONValue } /// Value getter/setter for $(D JSON_TYPE.OBJECT). - /// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.OBJECT). + /// Throws `JSONException` for read access if `type` is not $(D JSON_TYPE.OBJECT). @property ref inout(JSONValue[string]) object() inout { enforce!JSONException(type == JSON_TYPE.OBJECT, @@ -243,7 +243,7 @@ struct JSONValue } /// Value getter/setter for $(D JSON_TYPE.ARRAY). - /// Throws $(D JSONException) for read access if $(D type) is not $(D JSON_TYPE.ARRAY). + /// Throws `JSONException` for read access if `type` is not $(D JSON_TYPE.ARRAY). @property ref inout(JSONValue[]) array() inout { enforce!JSONException(type == JSON_TYPE.ARRAY, @@ -351,15 +351,15 @@ struct JSONValue } /** - * Constructor for $(D JSONValue). If $(D arg) is a $(D JSONValue) - * its value and type will be copied to the new $(D JSONValue). + * Constructor for `JSONValue`. If `arg` is a `JSONValue` + * its value and type will be copied to the new `JSONValue`. * Note that this is a shallow copy: if type is $(D JSON_TYPE.OBJECT) * or $(D JSON_TYPE.ARRAY) then only the reference to the data will * be copied. - * Otherwise, $(D arg) must be implicitly convertible to one of the - * following types: $(D typeof(null)), $(D string), $(D ulong), - * $(D long), $(D double), an associative array $(D V[K]) for any $(D V) - * and $(D K) i.e. a JSON object, any array or $(D bool). The type will + * Otherwise, `arg` must be implicitly convertible to one of the + * following types: `typeof(null)`, `string`, `ulong`, + * `long`, `double`, an associative array `V[K]` for any `V` + * and `K` i.e. a JSON object, any array or `bool`. The type will * be set accordingly. */ this(T)(T arg) if(!isStaticArray!T) @@ -401,7 +401,7 @@ struct JSONValue } /// Array syntax for json arrays. - /// Throws $(D JSONException) if $(D type) is not $(D JSON_TYPE.ARRAY). + /// Throws `JSONException` if `type` is not $(D JSON_TYPE.ARRAY). ref inout(JSONValue) opIndex(size_t i) inout { enforce!JSONException(type == JSON_TYPE.ARRAY, @@ -419,7 +419,7 @@ struct JSONValue } /// Hash syntax for json objects. - /// Throws $(D JSONException) if $(D type) is not $(D JSON_TYPE.OBJECT). + /// Throws `JSONException` if `type` is not $(D JSON_TYPE.OBJECT). ref inout(JSONValue) opIndex(string k) inout { enforce!JSONException(type == JSON_TYPE.OBJECT, @@ -434,10 +434,10 @@ struct JSONValue assert( j["language"].str() == "D" ); } - /// Operator sets $(D value) for element of JSON object by $(D key) + /// Operator sets `value` for element of JSON object by `key` /// If JSON value is null, then operator initializes it with object and then - /// sets $(D value) for it. - /// Throws $(D JSONException) if $(D type) is not $(D JSON_TYPE.OBJECT) + /// sets `value` for it. + /// Throws `JSONException` if `type` is not $(D JSON_TYPE.OBJECT) /// or $(D JSON_TYPE.NULL). void opIndexAssign(T)(auto ref T value, string key) { @@ -530,7 +530,7 @@ struct JSONValue string a = ("author" in j).str; } - /// Implements the foreach $(D opApply) interface for json arrays. + /// Implements the foreach `opApply` interface for json arrays. int opApply(int delegate(size_t index, ref JSONValue) dg) { enforce!JSONException(type == JSON_TYPE.ARRAY, @@ -547,7 +547,7 @@ struct JSONValue return result; } - /// Implements the foreach $(D opApply) interface for json objects. + /// Implements the foreach `opApply` interface for json objects. int opApply(int delegate(string key, ref JSONValue) dg) { enforce!JSONException(type == JSON_TYPE.OBJECT, @@ -564,13 +564,13 @@ struct JSONValue return result; } - /// Implicitly calls $(D toJSON) on this JSONValue. + /// Implicitly calls `toJSON` on this JSONValue. string toString() const { return toJSON(&this); } - /// Implicitly calls $(D toJSON) on this JSONValue, like $(D toString), but + /// Implicitly calls `toJSON` on this JSONValue, like `toString`, but /// also passes $(I true) as $(I pretty) argument. string toPrettyString() const { @@ -876,8 +876,8 @@ Takes a tree of JSON values and returns the serialized string. Any Object types will be serialized in a key-sorted order. -If $(D pretty) is false no whitespaces are generated. -If $(D pretty) is true serialized string is formatted to be human-readable. +If `pretty` is false no whitespaces are generated. +If `pretty` is true serialized string is formatted to be human-readable. */ string toJSON(in JSONValue* root, in bool pretty = false) { diff --git a/std/math.d b/std/math.d index 9156ef8a03f..4429b67f455 100644 --- a/std/math.d +++ b/std/math.d @@ -3,7 +3,7 @@ /** * Contains the elementary mathematical functions (powers, roots, * and trigonometric functions), and low-level floating-point operations. - * Mathematical special functions are available in $(D std.mathspecial). + * Mathematical special functions are available in `std.mathspecial`. * $(SCRIPT inhibitQuickIndex = 1;) @@ -2434,7 +2434,7 @@ unittest * Extracts the exponent of x as a signed integral value. * * If x is not a special value, the result is the same as - * $(D cast(int)logb(x)). + * `cast(int)logb(x)`. * * $(TABLE_SV * $(TR $(TH x) $(TH ilogb(x)) $(TH Range error?)) @@ -4920,7 +4920,7 @@ R copysign(R, X)(X to, R from) @trusted pure nothrow @nogc } /********************************* -Returns $(D -1) if $(D x < 0), $(D x) if $(D x == 0), $(D 1) if +Returns `-1` if $(D x < 0), `x` if $(D x == 0), `1` if $(D x > 0), and $(NAN) if x==$(NAN). */ F sgn(F)(F x) @safe pure nothrow @nogc @@ -6404,13 +6404,13 @@ body } /** - Computes whether $(D lhs) is approximately equal to $(D rhs) - admitting a maximum relative difference $(D maxRelDiff) and a - maximum absolute difference $(D maxAbsDiff). + Computes whether `lhs` is approximately equal to `rhs` + admitting a maximum relative difference `maxRelDiff` and a + maximum absolute difference `maxAbsDiff`. - If the two inputs are ranges, $(D approxEqual) returns true if and + If the two inputs are ranges, `approxEqual` returns true if and only if the ranges have the same number of elements and if $(D - approxEqual) evaluates to $(D true) for each pair of elements. + approxEqual) evaluates to `true` for each pair of elements. */ bool approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff, V maxAbsDiff = 1e-5) { diff --git a/std/net/curl.d b/std/net/curl.d index fd4644dfe87..b1e449cba5d 100644 --- a/std/net/curl.d +++ b/std/net/curl.d @@ -32,7 +32,7 @@ $(LINK2 http://dlang.org/download.html, download page). Compared to using libcurl directly this module allows simpler client code for common uses, requires no unsafe operations, and integrates better with the rest -of the language. Futhermore it provides $(D range) +of the language. Futhermore it provides `range` access to protocols supported by libcurl both synchronously and asynchronously. A high level and a low level API are available. The high level API is built @@ -40,7 +40,7 @@ entirely on top of the low level one. The high level API is for commonly used functionality such as HTTP/FTP get. The $(LREF byLineAsync) and $(LREF byChunkAsync) provides asynchronous $(D ranges) that performs the request in another +href="std_range.html">`ranges` that performs the request in another thread while handling a line/chunk in the current thread. The low level API allows for streaming and other advanced features. @@ -86,9 +86,9 @@ dlang.org web page asynchronously.) ) $(LEADINGROW Low level ) -$(TR $(TDNW $(LREF HTTP)) $(TD $(D HTTP) struct for advanced usage)) -$(TR $(TDNW $(LREF FTP)) $(TD $(D FTP) struct for advanced usage)) -$(TR $(TDNW $(LREF SMTP)) $(TD $(D SMTP) struct for advanced usage)) +$(TR $(TDNW $(LREF HTTP)) $(TD `HTTP` struct for advanced usage)) +$(TR $(TDNW $(LREF FTP)) $(TD `FTP` struct for advanced usage)) +$(TR $(TDNW $(LREF SMTP)) $(TD `SMTP` struct for advanced usage)) ) @@ -375,9 +375,9 @@ unittest * conn = connection to use e.g. FTP or HTTP. The default AutoProtocol will * guess connection type and create a new instance for this call only. * - * The template parameter $(D T) specifies the type to return. Possible values - * are $(D char) and $(D ubyte) to return $(D char[]) or $(D ubyte[]). If asking - * for $(D char), content will be converted from the connection character set + * The template parameter `T` specifies the type to return. Possible values + * are `char` and `ubyte` to return `char[]` or `ubyte[]`. If asking + * for `char`, content will be converted from the connection character set * (specified in HTTP response headers or FTP connection properties, both ISO-8859-1 * by default) to UTF-8. * @@ -392,7 +392,7 @@ unittest * * Throws: * - * $(D CurlException) on error. + * `CurlException` on error. * * See_Also: $(LREF HTTP.Method) */ @@ -443,9 +443,9 @@ unittest * conn = connection to use e.g. FTP or HTTP. The default AutoProtocol will * guess connection type and create a new instance for this call only. * - * The template parameter $(D T) specifies the type to return. Possible values - * are $(D char) and $(D ubyte) to return $(D char[]) or $(D ubyte[]). If asking - * for $(D char), content will be converted from the connection character set + * The template parameter `T` specifies the type to return. Possible values + * are `char` and `ubyte` to return `char[]` or `ubyte[]`. If asking + * for `char`, content will be converted from the connection character set * (specified in HTTP response headers or FTP connection properties, both ISO-8859-1 * by default) to UTF-8. * @@ -506,9 +506,9 @@ unittest * conn = connection to use e.g. FTP or HTTP. The default AutoProtocol will * guess connection type and create a new instance for this call only. * - * The template parameter $(D T) specifies the type to return. Possible values - * are $(D char) and $(D ubyte) to return $(D char[]) or $(D ubyte[]). If asking - * for $(D char), content will be converted from the connection character set + * The template parameter `T` specifies the type to return. Possible values + * are `char` and `ubyte` to return `char[]` or `ubyte[]`. If asking + * for `char`, content will be converted from the connection character set * (specified in HTTP response headers or FTP connection properties, both ISO-8859-1 * by default) to UTF-8. * @@ -623,8 +623,8 @@ unittest * conn = connection to use e.g. FTP or HTTP. The default AutoProtocol will * guess connection type and create a new instance for this call only. * - * The template parameter $(D T) specifies the type to return. Possible values - * are $(D char) and $(D ubyte) to return $(D char[]) or $(D ubyte[]). + * The template parameter `T` specifies the type to return. Possible values + * are `char` and `ubyte` to return `char[]` or `ubyte[]`. * Currently the HTTP RFC does not specify any usage of the optionsData and * for this reason the example below does not send optionsData to the server. * @@ -674,8 +674,8 @@ unittest * conn = connection to use e.g. FTP or HTTP. The default AutoProtocol will * guess connection type and create a new instance for this call only. * - * The template parameter $(D T) specifies the type to return. Possible values - * are $(D char) and $(D ubyte) to return $(D char[]) or $(D ubyte[]). + * The template parameter `T` specifies the type to return. Possible values + * are `char` and `ubyte` to return `char[]` or `ubyte[]`. * * Example: * ---- @@ -711,8 +711,8 @@ unittest * conn = connection to use e.g. FTP or HTTP. The default AutoProtocol will * guess connection type and create a new instance for this call only. * - * The template parameter $(D T) specifies the type to return. Possible values - * are $(D char) and $(D ubyte) to return $(D char[]) or $(D ubyte[]). + * The template parameter `T` specifies the type to return. Possible values + * are `char` and `ubyte` to return `char[]` or `ubyte[]`. * * Example: * ---- @@ -941,7 +941,7 @@ struct ByLineBuffer(Char) /** HTTP/FTP fetch content as a range of lines. * * A range of lines is returned when the request is complete. If the method or - * other request properties is to be customized then set the $(D conn) parameter + * other request properties is to be customized then set the `conn` parameter * with a HTTP/FTP instance that has these properties set. * * Example: @@ -1048,7 +1048,7 @@ unittest /** HTTP/FTP fetch content as a range of chunks. * * A range of chunks is returned when the request is complete. If the method or - * other request properties is to be customized then set the $(D conn) parameter + * other request properties is to be customized then set the `conn` parameter * with a HTTP/FTP instance that has these properties set. * * Example: @@ -1292,10 +1292,10 @@ static struct AsyncLineInputRange(Char) * * A range of lines is returned immediately and the request that fetches the * lines is performed in another thread. If the method or other request - * properties is to be customized then set the $(D conn) parameter with a + * properties is to be customized then set the `conn` parameter with a * HTTP/FTP instance that has these properties set. * - * If $(D postData) is non-_null the method will be set to $(D post) for HTTP + * If `postData` is non-_null the method will be set to `post` for HTTP * requests. * * The background thread will buffer up to transmitBuffers number of lines @@ -1304,7 +1304,7 @@ static struct AsyncLineInputRange(Char) * to receive more data from the network. * * If no data is available and the main thread accesses the range it will block - * until data becomes available. An exception to this is the $(D wait(Duration)) method on + * until data becomes available. An exception to this is the `wait(Duration)` method on * the $(LREF AsyncLineInputRange). This method will wait at maximum for the * specified duration and return true if data is available. * @@ -1447,10 +1447,10 @@ static struct AsyncChunkInputRange * * A range of chunks is returned immediately and the request that fetches the * chunks is performed in another thread. If the method or other request - * properties is to be customized then set the $(D conn) parameter with a + * properties is to be customized then set the `conn` parameter with a * HTTP/FTP instance that has these properties set. * - * If $(D postData) is non-_null the method will be set to $(D post) for HTTP + * If `postData` is non-_null the method will be set to `post` for HTTP * requests. * * The background thread will buffer up to transmitBuffers number of chunks @@ -1459,7 +1459,7 @@ static struct AsyncChunkInputRange * thread to receive more data from the network. * * If no data is available and the main thread access the range it will block - * until data becomes available. An exception to this is the $(D wait(Duration)) + * until data becomes available. An exception to this is the `wait(Duration)` * method on the $(LREF AsyncChunkInputRange). This method will wait at maximum for the specified * duration and return true if data is available. * @@ -1619,7 +1619,7 @@ private void _asyncDuplicateConnection(Conn, PostData) private mixin template Protocol() { - /// Value to return from $(D onSend)/$(D onReceive) delegates in order to + /// Value to return from `onSend`/`onReceive` delegates in order to /// pause a request alias requestPause = CurlReadFunc.pause; @@ -1844,15 +1844,15 @@ private mixin template Protocol() /** * The event handler that gets called when data is needed for sending. The - * length of the $(D void[]) specifies the maximum number of bytes that can + * length of the `void[]` specifies the maximum number of bytes that can * be sent. * * Returns: * The callback returns the number of elements in the buffer that have been * filled and are ready to send. - * The special value $(D .abortRequest) can be returned in order to abort the + * The special value `.abortRequest` can be returned in order to abort the * current request. - * The special value $(D .pauseRequest) can be returned in order to pause the + * The special value `.pauseRequest` can be returned in order to pause the * current request. * * Example: @@ -1939,8 +1939,8 @@ private mixin template Protocol() } /* - Decode $(D ubyte[]) array using the provided EncodingScheme up to maxChars - Returns: Tuple of ubytes read and the $(D Char[]) characters decoded. + Decode `ubyte[]` array using the provided EncodingScheme up to maxChars + Returns: Tuple of ubytes read and the `Char[]` characters decoded. Not all ubytes are guaranteed to be read in case of decoding error. */ private Tuple!(size_t,Char[]) @@ -1965,7 +1965,7 @@ decodeString(Char = char)(const(ubyte)[] data, } /* - Decode $(D ubyte[]) array using the provided $(D EncodingScheme) until a the + Decode `ubyte[]` array using the provided `EncodingScheme` until a the line terminator specified is found. The basesrc parameter is effectively prepended to src as the first thing. @@ -2237,7 +2237,7 @@ struct HTTP Perform a http request. After the HTTP client has been setup and possibly assigned callbacks the - $(D perform()) method will start performing the request towards the + `perform()` method will start performing the request towards the specified server. Params: @@ -2297,7 +2297,7 @@ struct HTTP // docs mixed in. version (StdDdoc) { - /// Value to return from $(D onSend)/$(D onReceive) delegates in order to + /// Value to return from `onSend`/`onReceive` delegates in order to /// pause a request alias requestPause = CurlReadFunc.pause; @@ -2422,15 +2422,15 @@ struct HTTP /** * The event handler that gets called when data is needed for sending. The - * length of the $(D void[]) specifies the maximum number of bytes that can + * length of the `void[]` specifies the maximum number of bytes that can * be sent. * * Returns: * The callback returns the number of elements in the buffer that have been * filled and are ready to send. - * The special value $(D .abortRequest) can be returned in order to abort the + * The special value `.abortRequest` can be returned in order to abort the * current request. - * The special value $(D .pauseRequest) can be returned in order to pause the + * The special value `.pauseRequest` can be returned in order to pause the * current request. * * Example: @@ -2561,7 +2561,7 @@ struct HTTP /** Set the value of the user agent request header field. * * By default a request has it's "User-Agent" field set to $(LREF - * defaultUserAgent) even if $(D setUserAgent) was never called. Pass + * defaultUserAgent) even if `setUserAgent` was never called. Pass * an empty string to suppress the "User-Agent" field altogether. */ void setUserAgent(const(char)[] userAgent) @@ -2634,7 +2634,7 @@ struct HTTP Set time condition on the request. Params: - cond = $(D CurlTimeCond.{none,ifmodsince,ifunmodsince,lastmod}) + cond = `CurlTimeCond.{none,ifmodsince,ifunmodsince,lastmod}` timestamp = Timestamp for the condition $(WEB www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25, _RFC2616 Section 14.25) @@ -2732,7 +2732,7 @@ struct HTTP * Set the event handler that receives incoming headers. * * The callback will receive a header field key, value as parameter. The - * $(D const(char)[]) arrays are not valid after the delegate has returned. + * `const(char)[]` arrays are not valid after the delegate has returned. * * Example: * ---- @@ -2753,7 +2753,7 @@ struct HTTP Callback for each received StatusLine. Notice that several callbacks can be done for each call to - $(D perform()) due to redirections. + `perform()` due to redirections. See_Also: $(LREF StatusLine) */ @@ -2965,7 +2965,7 @@ struct FTP // docs mixed in. version (StdDdoc) { - /// Value to return from $(D onSend)/$(D onReceive) delegates in order to + /// Value to return from `onSend`/`onReceive` delegates in order to /// pause a request alias requestPause = CurlReadFunc.pause; @@ -3090,15 +3090,15 @@ struct FTP /** * The event handler that gets called when data is needed for sending. The - * length of the $(D void[]) specifies the maximum number of bytes that can + * length of the `void[]` specifies the maximum number of bytes that can * be sent. * * Returns: * The callback returns the number of elements in the buffer that have been * filled and are ready to send. - * The special value $(D .abortRequest) can be returned in order to abort the + * The special value `.abortRequest` can be returned in order to abort the * current request. - * The special value $(D .pauseRequest) can be returned in order to pause the + * The special value `.pauseRequest` can be returned in order to pause the * current request. * */ @@ -3314,7 +3314,7 @@ struct SMTP // docs mixed in. version (StdDdoc) { - /// Value to return from $(D onSend)/$(D onReceive) delegates in order to + /// Value to return from `onSend`/`onReceive` delegates in order to /// pause a request alias requestPause = CurlReadFunc.pause; @@ -3439,15 +3439,15 @@ struct SMTP /** * The event handler that gets called when data is needed for sending. The - * length of the $(D void[]) specifies the maximum number of bytes that can + * length of the `void[]` specifies the maximum number of bytes that can * be sent. * * Returns: * The callback returns the number of elements in the buffer that have been * filled and are ready to send. - * The special value $(D .abortRequest) can be returned in order to abort the + * The special value `.abortRequest` can be returned in order to abort the * current request. - * The special value $(D .pauseRequest) can be returned in order to pause the + * The special value `.pauseRequest` can be returned in order to pause the * current request. */ @property void onSend(size_t delegate(void[]) callback); @@ -3567,7 +3567,7 @@ alias ThrowOnError = Flag!"throwOnError"; /** Wrapper to provide a better interface to libcurl than using the plain C API. - It is recommended to use the $(D HTTP)/$(D FTP) etc. structs instead unless + It is recommended to use the `HTTP`/`FTP` etc. structs instead unless raw access to libcurl is needed. Warning: This struct uses interior pointers for callbacks. Only allocate it @@ -3710,7 +3710,7 @@ struct Curl /** Stop and invalidate this curl instance. - Warning: Do not call this from inside a callback handler e.g. $(D onReceive). + Warning: Do not call this from inside a callback handler e.g. `onReceive`. */ void shutdown() { @@ -3821,7 +3821,7 @@ struct Curl * The event handler that receives incoming data. * * Params: - * callback = the callback that receives the $(D ubyte[]) data. + * callback = the callback that receives the `ubyte[]` data. * Be sure to copy the incoming data and not store * a slice. * @@ -3889,14 +3889,14 @@ struct Curl * The event handler that gets called when data is needed for sending. * * Params: - * callback = the callback that has a $(D void[]) buffer to be filled + * callback = the callback that has a `void[]` buffer to be filled * * Returns: * The callback returns the number of elements in the buffer that have been * filled and are ready to send. - * The special value $(D Curl.abortRequest) can be returned in + * The special value `Curl.abortRequest` can be returned in * order to abort the current request. - * The special value $(D Curl.pauseRequest) can be returned in order to + * The special value `Curl.pauseRequest` can be returned in order to * pause the current request. * * Example: @@ -3968,7 +3968,7 @@ struct Curl /** * The event handler that gets called when the net socket has been created - * but a $(D connect()) call has not yet been done. This makes it possible to set + * but a `connect()` call has not yet been done. This makes it possible to set * misc. socket options. * * Params: diff --git a/std/numeric.d b/std/numeric.d index 4c059e1dc17..de38578543c 100644 --- a/std/numeric.d +++ b/std/numeric.d @@ -43,7 +43,7 @@ public enum CustomFloatFlags /** * Store values in normalized form by default. The actual precision of the * significand is extended by 1 bit by assuming an implicit leading bit of 1 - * instead of 0. i.e. $(D 1.nnnn) instead of $(D 0.nnnn). + * instead of 0. i.e. `1.nnnn` instead of `0.nnnn`. * True for all $(LUCKY IEE754) types */ storeNormalized = 2, @@ -128,7 +128,7 @@ private template CustomFloatParams(uint precision, uint exponentWidth, CustomFlo /** * Allows user code to define custom floating-point formats. These formats are * for storage only; all operations on them are performed by first implicitly - * extracting them to $(D real) first. After the operation is completed the + * extracting them to `real` first. After the operation is completed the * result can be stored in a custom floating-point value via assignment. */ template CustomFloat(uint bits) @@ -496,7 +496,7 @@ public: /// Returns: imaginary part static @property CustomFloat im() { return CustomFloat(0.0f); } - /// Initialize from any $(D real) compatible type. + /// Initialize from any `real` compatible type. this(F)(F input) if (__traits(compiles, cast(real)input )) { this = input; @@ -511,7 +511,7 @@ public: significand = input.significand; } - /// Assigns from any $(D real) compatible type. + /// Assigns from any `real` compatible type. void opAssign(F)(F input) if (__traits(compiles, cast(real)input)) { @@ -544,7 +544,7 @@ public: significand = cast(T_sig) sig; } - /// Fetches the stored value either as a $(D float), $(D double) or $(D real). + /// Fetches the stored value either as a `float`, `double` or `real`. @property F get(F)() if (staticIndexOf!(Unqual!F, float, double, real) >= 0) { @@ -674,24 +674,24 @@ unittest /** Defines the fastest type to use when storing temporaries of a -calculation intended to ultimately yield a result of type $(D F) -(where $(D F) must be one of $(D float), $(D double), or $(D +calculation intended to ultimately yield a result of type `F` +(where `F` must be one of `float`, `double`, or $(D real)). When doing a multi-step computation, you may want to store -intermediate results as $(D FPTemporary!F). +intermediate results as `FPTemporary!F`. -The necessity of $(D FPTemporary) stems from the optimized +The necessity of `FPTemporary` stems from the optimized floating-point operations and registers present in virtually all processors. When adding numbers in the example above, the addition may -in fact be done in $(D real) precision internally. In that case, -storing the intermediate $(D result) in $(D double format) is not only +in fact be done in `real` precision internally. In that case, +storing the intermediate `result` in $(D double format) is not only less precise, it is also (surprisingly) slower, because a conversion -from $(D real) to $(D double) is performed every pass through the -loop. This being a lose-lose situation, $(D FPTemporary!F) has been +from `real` to `double` is performed every pass through the +loop. This being a lose-lose situation, `FPTemporary!F` has been defined as the $(I fastest) type to use for calculations at precision -$(D F). There is no need to define a type for the $(I most accurate) -calculations, as that is always $(D real). +`F`. There is no need to define a type for the $(I most accurate) +calculations, as that is always `real`. -Finally, there is no guarantee that using $(D FPTemporary!F) will +Finally, there is no guarantee that using `FPTemporary!F` will always be fastest, as the speed of floating-point calculations depends on very many factors. */ @@ -719,9 +719,9 @@ unittest /** Implements the $(WEB tinyurl.com/2zb9yr, secant method) for finding a -root of the function $(D fun) starting from points $(D [xn_1, x_n]) -(ideally close to the root). $(D Num) may be $(D float), $(D double), -or $(D real). +root of the function `fun` starting from points $(D [xn_1, x_n]) +(ideally close to the root). `Num` may be `float`, `double`, +or `real`. */ template secantMethod(alias fun) { @@ -782,11 +782,11 @@ public: /** Find a real root of a real function f(x) via bracketing. * - * Given a function $(D f) and a range $(D [a..b]) such that $(D f(a)) - * and $(D f(b)) have opposite signs, returns the value of $(D x) in - * the range which is closest to a root of $(D f(x)). If $(D f(x)) + * Given a function `f` and a range `[a..b]` such that `f(a)` + * and `f(b)` have opposite signs, returns the value of `x` in + * the range which is closest to a root of `f(x)`. If `f(x)` * has more than one root in the range, one will be chosen - * arbitrarily. If $(D f(x)) returns NaN, NaN will be returned; + * arbitrarily. If `f(x)` returns NaN, NaN will be returned; * otherwise, this algorithm is guaranteed to succeed. * * Uses an algorithm based on TOMS748, which uses inverse cubic @@ -794,7 +794,7 @@ public: * or secant interpolation. Compared to TOMS748, this implementation * improves worst-case performance by a factor of more than 100, and * typical performance by a factor of 2. For 80-bit reals, most - * problems require 8 to 15 calls to $(D f(x)) to achieve full machine + * problems require 8 to 15 calls to `f(x)` to achieve full machine * precision. The worst-case performance (pathological cases) is * approximately twice the number of bits. * @@ -830,28 +830,28 @@ T findRoot(T, DF)(scope DF f, in T a, in T b) * * f = Function to be analyzed * - * ax = Left bound of initial range of $(D f) known to contain the + * ax = Left bound of initial range of `f` known to contain the * root. * - * bx = Right bound of initial range of $(D f) known to contain the + * bx = Right bound of initial range of `f` known to contain the * root. * - * fax = Value of $(D f(ax)). + * fax = Value of `f(ax)`. * - * fbx = Value of $(D f(bx)). ($(D f(ax)) and $(D f(bx)) are commonly + * fbx = Value of `f(bx)`. (`f(ax)` and `f(bx)` are commonly * known in advance.) * * * tolerance = Defines an early termination condition. Receives the * current upper and lower bounds on the root. The - * delegate must return $(D true) when these bounds are - * acceptable. If this function always returns $(D false), + * delegate must return `true` when these bounds are + * acceptable. If this function always returns `false`, * full machine precision will be achieved. * * Returns: * * A tuple consisting of two ranges. The first two elements are the - * range (in $(D x)) of the root, while the second pair of elements + * range (in `x`) of the root, while the second pair of elements * are the corresponding function values at those points. If an exact * root was found, both of the first two elements will contain the * root, and the second pair of elements will be 0. @@ -1391,10 +1391,10 @@ unittest } /** -Computes $(LUCKY Euclidean distance) between input ranges $(D a) and -$(D b). The two ranges must have the same length. The three-parameter +Computes $(LUCKY Euclidean distance) between input ranges `a` and +`b`. The two ranges must have the same length. The three-parameter version stops computation as soon as the distance is greater than or -equal to $(D limit) (this is useful to save computation if a small +equal to `limit` (this is useful to save computation if a small distance is sought). */ CommonType!(ElementType!(Range1), ElementType!(Range2)) @@ -1451,7 +1451,7 @@ unittest } /** -Computes the $(LUCKY dot product) of input ranges $(D a) and $(D +Computes the $(LUCKY dot product) of input ranges `a` and $(D b). The two ranges must have the same length. If both ranges define length, the check is done once; otherwise, it is done at each iteration. @@ -1546,7 +1546,7 @@ unittest } /** -Computes the $(LUCKY cosine similarity) of input ranges $(D a) and $(D +Computes the $(LUCKY cosine similarity) of input ranges `a` and $(D b). The two ranges must have the same length. If both ranges define length, the check is done once; otherwise, it is done at each iteration. If either range has all-zero elements, return 0. @@ -1584,14 +1584,14 @@ unittest } /** -Normalizes values in $(D range) by multiplying each element with a -number chosen such that values sum up to $(D sum). If elements in $(D +Normalizes values in `range` by multiplying each element with a +number chosen such that values sum up to `sum`. If elements in $(D range) sum to zero, assigns $(D sum / range.length) to -all. Normalization makes sense only if all elements in $(D range) are -positive. $(D normalize) assumes that is the case without checking it. +all. Normalization makes sense only if all elements in `range` are +positive. `normalize` assumes that is the case without checking it. -Returns: $(D true) if normalization completed normally, $(D false) if -all elements in $(D range) were zero or if $(D range) is empty. +Returns: `true` if normalization completed normally, `false` if +all elements in `range` were zero or if `range` is empty. */ bool normalize(R)(R range, ElementType!(R) sum = 1) if (isForwardRange!(R)) @@ -1647,7 +1647,7 @@ unittest } /** -Computes accurate sum of binary logarithms of input range $(D r). +Computes accurate sum of binary logarithms of input range `r`. */ ElementType!Range sumOfLog2s(Range)(Range r) if (isInputRange!Range && isFloatingPoint!(ElementType!Range)) @@ -1686,12 +1686,12 @@ unittest } /** -Computes $(LUCKY _entropy) of input range $(D r) in bits. This -function assumes (without checking) that the values in $(D r) are all -in $(D [0, 1]). For the entropy to be meaningful, often $(D r) should +Computes $(LUCKY _entropy) of input range `r` in bits. This +function assumes (without checking) that the values in `r` are all +in $(D [0, 1]). For the entropy to be meaningful, often `r` should be normalized too (i.e., its values should sum to 1). The two-parameter version stops evaluating as soon as the intermediate -result is greater than or equal to $(D max). +result is greater than or equal to `max`. */ ElementType!Range entropy(Range)(Range r) if (isInputRange!Range) { @@ -1734,12 +1734,12 @@ unittest /** Computes the $(LUCKY Kullback-Leibler divergence) between input ranges -$(D a) and $(D b), which is the sum $(D ai * log(ai / bi)). The base +`a` and `b`, which is the sum $(D ai * log(ai / bi)). The base of logarithm is 2. The ranges are assumed to contain elements in $(D [0, 1]). Usually the ranges are normalized probability distributions, but this is not required or checked by $(D -kullbackLeiblerDivergence). If any element $(D bi) is zero and the -corresponding element $(D ai) nonzero, returns infinity. (Otherwise, +kullbackLeiblerDivergence). If any element `bi` is zero and the +corresponding element `ai` nonzero, returns infinity. (Otherwise, if $(D ai == 0 && bi == 0), the term $(D ai * log(ai / bi)) is considered zero.) If the inputs are normalized, the result is positive. @@ -1779,15 +1779,15 @@ unittest } /** -Computes the $(LUCKY Jensen-Shannon divergence) between $(D a) and $(D +Computes the $(LUCKY Jensen-Shannon divergence) between `a` and $(D b), which is the sum $(D (ai * log(2 * ai / (ai + bi)) + bi * log(2 * bi / (ai + bi))) / 2). The base of logarithm is 2. The ranges are assumed to contain elements in $(D [0, 1]). Usually the ranges are normalized probability distributions, but this is not required or -checked by $(D jensenShannonDivergence). If the inputs are normalized, +checked by `jensenShannonDivergence`. If the inputs are normalized, the result is bounded within $(D [0, 1]). The three-parameter version stops evaluations as soon as the intermediate result is greater than -or equal to $(D limit). +or equal to `limit`. */ CommonType!(ElementType!Range1, ElementType!Range2) jensenShannonDivergence(Range1, Range2)(Range1 a, Range2 b) @@ -1861,18 +1861,18 @@ unittest /** The so-called "all-lengths gap-weighted string kernel" computes a -similarity measure between $(D s) and $(D t) based on all of their +similarity measure between `s` and `t` based on all of their common subsequences of all lengths. Gapped subsequences are also included. To understand what $(D gapWeightedSimilarity(s, t, lambda)) computes, consider first the case $(D lambda = 1) and the strings $(D s = ["Hello", "brave", "new", "world"]) and $(D t = ["Hello", "new", -"world"]). In that case, $(D gapWeightedSimilarity) counts the +"world"]). In that case, `gapWeightedSimilarity` counts the following matches: -$(OL $(LI three matches of length 1, namely $(D "Hello"), $(D "new"), -and $(D "world");) $(LI three matches of length 2, namely ($(D +$(OL $(LI three matches of length 1, namely `"Hello"`, `"new"`, +and `"world"`;) $(LI three matches of length 2, namely ($(D "Hello", "new")), ($(D "Hello", "world")), and ($(D "new", "world"));) $(LI one match of length 3, namely ($(D "Hello", "new", "world")).)) @@ -1903,12 +1903,12 @@ tally. That leaves only 4 matches. The most interesting case is when gapped matches still participate in the result, but not as strongly as ungapped matches. The result will be a smooth, fine-grained similarity measure between the input -strings. This is where values of $(D lambda) between 0 and 1 enter +strings. This is where values of `lambda` between 0 and 1 enter into play: gapped matches are $(I exponentially penalized with the -number of gaps) with base $(D lambda). This means that an ungapped +number of gaps) with base `lambda`. This means that an ungapped match adds 1 to the return value; a match with one gap in either -string adds $(D lambda) to the return value; ...; a match with a total -of $(D n) gaps in both strings adds $(D pow(lambda, n)) to the return +string adds `lambda` to the return value; ...; a match with a total +of `n` gaps in both strings adds $(D pow(lambda, n)) to the return value. In the example above, we have 4 matches without gaps, 2 matches with one gap, and 1 match with three gaps. The latter match is ($(D "Hello", "world")), which has two gaps in the first string and one gap @@ -1921,11 +1921,11 @@ string[] t = ["Hello", "new", "world"]; assert(gapWeightedSimilarity(s, t, 0.5) == 4 + 0.5 * 2 + 0.125); ---- -$(D gapWeightedSimilarity) is useful wherever a smooth similarity +`gapWeightedSimilarity` is useful wherever a smooth similarity measure between sequences allowing for approximate matches is needed. The examples above are given with words, but any sequences with elements comparable for equality are allowed, e.g. characters or -numbers. $(D gapWeightedSimilarity) uses a highly optimized dynamic +numbers. `gapWeightedSimilarity` uses a highly optimized dynamic programming implementation that needs $(D 16 * min(s.length, t.length)) extra bytes of memory and $(BIGOH s.length * t.length) time to complete. @@ -1986,25 +1986,25 @@ unittest } /** -The similarity per $(D gapWeightedSimilarity) has an issue in that it +The similarity per `gapWeightedSimilarity` has an issue in that it grows with the lengths of the two strings, even though the strings are not actually very similar. For example, the range $(D ["Hello", "world"]) is increasingly similar with the range $(D ["Hello", -"world", "world", "world",...]) as more instances of $(D "world") are -appended. To prevent that, $(D gapWeightedSimilarityNormalized) +"world", "world", "world",...]) as more instances of `"world"` are +appended. To prevent that, `gapWeightedSimilarityNormalized` computes a normalized version of the similarity that is computed as $(D gapWeightedSimilarity(s, t, lambda) / sqrt(gapWeightedSimilarity(s, t, lambda) * gapWeightedSimilarity(s, t, -lambda))). The function $(D gapWeightedSimilarityNormalized) (a -so-called normalized kernel) is bounded in $(D [0, 1]), reaches $(D 0) -only for ranges that don't match in any position, and $(D 1) only for +lambda))). The function `gapWeightedSimilarityNormalized` (a +so-called normalized kernel) is bounded in $(D [0, 1]), reaches `0` +only for ranges that don't match in any position, and `1` only for identical ranges. -The optional parameters $(D sSelfSim) and $(D tSelfSim) are meant for +The optional parameters `sSelfSim` and `tSelfSim` are meant for avoiding duplicate computation. Many applications may have already computed $(D gapWeightedSimilarity(s, s, lambda)) and/or $(D gapWeightedSimilarity(t, t, lambda)). In that case, they can be passed -as $(D sSelfSim) and $(D tSelfSim), respectively. +as `sSelfSim` and `tSelfSim`, respectively. */ Select!(isFloatingPoint!(F), F, double) gapWeightedSimilarityNormalized(alias comp = "a == b", R1, R2, F) @@ -2043,7 +2043,7 @@ unittest } /** -Similar to $(D gapWeightedSimilarity), just works in an incremental +Similar to `gapWeightedSimilarity`, just works in an incremental manner by first revealing the matches of length 1, then gapped matches of length 2, and so on. The memory requirement is $(BIGOH s.length * t.length). The time complexity is $(BIGOH s.length * t.length) time @@ -2069,8 +2069,8 @@ private: public: /** -Constructs an object given two ranges $(D s) and $(D t) and a penalty -$(D lambda). Constructor completes in $(BIGOH s.length * t.length) +Constructs an object given two ranges `s` and `t` and a penalty +`lambda`. Constructor completes in $(BIGOH s.length * t.length) time and computes all matches of length 1. */ this(Range s, Range t, F lambda) @@ -2130,7 +2130,7 @@ time and computes all matches of length 1. } /** - Returns: $(D this). + Returns: `this`. */ ref GapWeightedSimilarityIncremental opSlice() { @@ -2223,7 +2223,7 @@ time and computes all matches of length 1. /** Returns: The gapped similarity at the current match length (initially - 1, grows with each call to $(D popFront)). + 1, grows with each call to `popFront`). */ @property F front() { return currentValue; } @@ -2337,7 +2337,7 @@ unittest } /** -Computes the greatest common divisor of $(D a) and $(D b) by using +Computes the greatest common divisor of `a` and `b` by using Euclid's algorithm. */ T gcd(T)(T a, T b) @@ -2679,8 +2679,8 @@ private: } public: - /**Create an $(D Fft) object for computing fast Fourier transforms of - * power of two sizes of $(D size) or smaller. $(D size) must be a + /**Create an `Fft` object for computing fast Fourier transforms of + * power of two sizes of `size` or smaller. `size` must be a * power of two. */ this(size_t size) @@ -2697,11 +2697,11 @@ public: } /**Compute the Fourier transform of range using the $(BIGOH N log N) - * Cooley-Tukey Algorithm. $(D range) must be a random-access range with - * slicing and a length equal to $(D size) as provided at the construction of + * Cooley-Tukey Algorithm. `range` must be a random-access range with + * slicing and a length equal to `size` as provided at the construction of * this object. The contents of range can be either numeric types, * which will be interpreted as pure real values, or complex types with - * properties or members $(D .re) and $(D .im) that can be read. + * properties or members `.re` and `.im` that can be read. * * Note: Pure real FFTs are automatically detected and the relevant * optimizations are performed. @@ -2840,7 +2840,7 @@ private enum string MakeLocalFft = q{ auto fftObj = scoped!Fft(lookupBuf); }; -/**Convenience functions that create an $(D Fft) object, run the FFT or inverse +/**Convenience functions that create an `Fft` object, run the FFT or inverse * FFT and return the result. Useful for one-off FFTs. * * Note: In addition to convenience, these functions are slightly more diff --git a/std/outbuffer.d b/std/outbuffer.d index e15229bca4e..cb27af78580 100644 --- a/std/outbuffer.d +++ b/std/outbuffer.d @@ -1,7 +1,7 @@ // Written in the D programming language. /** -Serialize data to $(D ubyte) arrays. +Serialize data to `ubyte` arrays. * Macros: * WIKI = Phobos/StdOutbuffer diff --git a/std/parallelism.d b/std/parallelism.d index 1590c255818..e3a476e5e46 100644 --- a/std/parallelism.d +++ b/std/parallelism.d @@ -5,31 +5,31 @@ and future/promise _parallelism. $(D std._parallelism) is recommended when the same operation is to be executed in parallel on different data, or when a function is to be executed in a background thread and its result returned to a well-defined main thread. For communication between arbitrary threads, see -$(D std.concurrency). +`std.concurrency`. -$(D std._parallelism) is based on the concept of a $(D Task). A $(D Task) is an +$(D std._parallelism) is based on the concept of a `Task`. A `Task` is an object that represents the fundamental unit of work in this library and may be -executed in parallel with any other $(D Task). Using $(D Task) +executed in parallel with any other `Task`. Using `Task` directly allows programming with a future/promise paradigm. All other supported _parallelism paradigms (parallel foreach, map, reduce, pipelining) -represent an additional level of abstraction over $(D Task). They -automatically create one or more $(D Task) objects, or closely related types +represent an additional level of abstraction over `Task`. They +automatically create one or more `Task` objects, or closely related types that are conceptually identical but not part of the public API. -After creation, a $(D Task) may be executed in a new thread, or submitted -to a $(D TaskPool) for execution. A $(D TaskPool) encapsulates a task queue +After creation, a `Task` may be executed in a new thread, or submitted +to a `TaskPool` for execution. A `TaskPool` encapsulates a task queue and its worker threads. Its purpose is to efficiently map a large -number of $(D Task)s onto a smaller number of threads. A task queue is a -FIFO queue of $(D Task) objects that have been submitted to the -$(D TaskPool) and are awaiting execution. A worker thread is a thread that -is associated with exactly one task queue. It executes the $(D Task) at the +number of `Task`s onto a smaller number of threads. A task queue is a +FIFO queue of `Task` objects that have been submitted to the +`TaskPool` and are awaiting execution. A worker thread is a thread that +is associated with exactly one task queue. It executes the `Task` at the front of its queue when the queue has work available, or sleeps when no work is available. Each task queue is associated with zero or -more worker threads. If the result of a $(D Task) is needed before execution -by a worker thread has begun, the $(D Task) can be removed from the task queue +more worker threads. If the result of a `Task` is needed before execution +by a worker thread has begun, the `Task` can be removed from the task queue and executed immediately in the thread where the result is needed. -Warning: Unless marked as $(D @trusted) or $(D @safe), artifacts in +Warning: Unless marked as `@trusted` or `@safe`, artifacts in this module allow implicit data sharing between threads and cannot guarantee that client code is free from low level data races. @@ -417,32 +417,32 @@ private struct AbstractTask } /** -$(D Task) represents the fundamental unit of work. A $(D Task) may be -executed in parallel with any other $(D Task). Using this struct directly +`Task` represents the fundamental unit of work. A `Task` may be +executed in parallel with any other `Task`. Using this struct directly allows future/promise _parallelism. In this paradigm, a function (or delegate or other callable) is executed in a thread other than the one it was called from. The calling thread does not block while the function is being executed. -A call to $(D workForce), $(D yieldForce), or $(D spinForce) is used to -ensure that the $(D Task) has finished executing and to obtain the return -value, if any. These functions and $(D done) also act as full memory barriers, -meaning that any memory writes made in the thread that executed the $(D Task) +A call to `workForce`, `yieldForce`, or `spinForce` is used to +ensure that the `Task` has finished executing and to obtain the return +value, if any. These functions and `done` also act as full memory barriers, +meaning that any memory writes made in the thread that executed the `Task` are guaranteed to be visible in the calling thread after one of these functions returns. The $(XREF parallelism, task) and $(XREF parallelism, scopedTask) functions can -be used to create an instance of this struct. See $(D task) for usage examples. +be used to create an instance of this struct. See `task` for usage examples. -Function results are returned from $(D yieldForce), $(D spinForce) and -$(D workForce) by ref. If $(D fun) returns by ref, the reference will point -to the returned reference of $(D fun). Otherwise it will point to a +Function results are returned from `yieldForce`, `spinForce` and +`workForce` by ref. If `fun` returns by ref, the reference will point +to the returned reference of `fun`. Otherwise it will point to a field in this struct. Copying of this struct is disabled, since it would provide no useful semantics. If you want to pass this struct around, you should do so by reference or pointer. -Bugs: Changes to $(D ref) and $(D out) arguments are not propagated to the - call site, only to $(D args) in this struct. +Bugs: Changes to `ref` and `out` arguments are not propagated to the + call site, only to `args` in this struct. */ struct Task(alias fun, Args...) { @@ -477,8 +477,8 @@ struct Task(alias fun, Args...) Args _args; /** - The arguments the function was called with. Changes to $(D out) and - $(D ref) arguments will be visible here. + The arguments the function was called with. Changes to `out` and + `ref` arguments will be visible here. */ static if(__traits(isSame, fun, run)) { @@ -519,8 +519,8 @@ struct Task(alias fun, Args...) /** - The return type of the function called by this $(D Task). This can be - $(D void). + The return type of the function called by this `Task`. This can be + `void`. */ alias ReturnType = typeof(fun(_args)); @@ -582,13 +582,13 @@ struct Task(alias fun, Args...) } /** - If the $(D Task) isn't started yet, execute it in the current thread. + If the `Task` isn't started yet, execute it in the current thread. If it's done, return its return value, if any. If it's in progress, busy spin until it's done, then return the return value. If it threw an exception, rethrow that exception. This function should be used when you expect the result of the - $(D Task) to be available on a timescale shorter than that of an OS + `Task` to be available on a timescale shorter than that of an OS context switch. */ @property ref ReturnType spinForce() @trusted @@ -611,7 +611,7 @@ struct Task(alias fun, Args...) } /** - If the $(D Task) isn't started yet, execute it in the current thread. + If the `Task` isn't started yet, execute it in the current thread. If it's done, return its return value, if any. If it's in progress, wait on a condition variable. If it threw an exception, rethrow that exception. @@ -656,13 +656,13 @@ struct Task(alias fun, Args...) } /** - If this $(D Task) was not started yet, execute it in the current + If this `Task` was not started yet, execute it in the current thread. If it is finished, return its result. If it is in progress, - execute any other $(D Task) from the $(D TaskPool) instance that - this $(D Task) was submitted to until this one + execute any other `Task` from the `TaskPool` instance that + this `Task` was submitted to until this one is finished. If it threw an exception, rethrow that exception. - If no other tasks are available or this $(D Task) was executed using - $(D executeInNewThread), wait on a condition variable. + If no other tasks are available or this `Task` was executed using + `executeInNewThread`, wait on a condition variable. */ @property ref ReturnType workForce() @trusted { @@ -730,10 +730,10 @@ struct Task(alias fun, Args...) } /** - Returns $(D true) if the $(D Task) is finished executing. + Returns `true` if the `Task` is finished executing. Throws: Rethrows any exception thrown during the execution of the - $(D Task). + `Task`. */ @property bool done() @trusted { @@ -742,11 +742,11 @@ struct Task(alias fun, Args...) } /** - Create a new thread for executing this $(D Task), execute it in the + Create a new thread for executing this `Task`, execute it in the newly created thread, then terminate the thread. This can be used for future/promise parallelism. An explicit priority may be given - to the $(D Task). If one is provided, its value is forwarded to - $(D core.thread.Thread.priority). See $(XREF parallelism, task) for + to the `Task`. If one is provided, its value is forwarded to + `core.thread.Thread.priority`. See $(XREF parallelism, task) for usage example. */ void executeInNewThread() @trusted @@ -773,8 +773,8 @@ struct Task(alias fun, Args...) //@disable this(this) {} } -// Calls $(D fpOrDelegate) with $(D args). This is an -// adapter that makes $(D Task) work with delegates, function pointers and +// Calls `fpOrDelegate` with `args`. This is an +// adapter that makes `Task` work with delegates, function pointers and // functors instead of just aliases. ReturnType!F run(F, Args...)(F fpOrDelegate, ref Args args) { @@ -782,12 +782,12 @@ ReturnType!F run(F, Args...)(F fpOrDelegate, ref Args args) } /** -Creates a $(D Task) on the GC heap that calls an alias. This may be executed -via $(D Task.executeInNewThread) or by submitting to a +Creates a `Task` on the GC heap that calls an alias. This may be executed +via `Task.executeInNewThread` or by submitting to a $(XREF parallelism, TaskPool). A globally accessible instance of -$(D TaskPool) is provided by $(XREF parallelism, taskPool). +`TaskPool` is provided by $(XREF parallelism, taskPool). -Returns: A pointer to the $(D Task). +Returns: A pointer to the `Task`. Examples: --- @@ -853,7 +853,7 @@ auto task(alias fun, Args...)(Args args) } /** -Creates a $(D Task) on the GC heap that calls a function pointer, delegate, or +Creates a `Task` on the GC heap that calls a function pointer, delegate, or class/struct with overloaded opCall. Examples: @@ -880,7 +880,7 @@ void main() Notes: This function takes a non-scope delegate, meaning it can be used with closures. If you can't allocate a closure due to objects - on the stack that have scoped destruction, see $(D scopedTask), which + on the stack that have scoped destruction, see `scopedTask`, which takes a scope delegate. */ auto task(F, Args...)(F delegateOrFp, Args args) @@ -890,24 +890,24 @@ if(is(typeof(delegateOrFp(args))) && !isSafeTask!F) } /** -Version of $(D task) usable from $(D @safe) code. Usage mechanics are +Version of `task` usable from `@safe` code. Usage mechanics are identical to the non-@safe case, but safety introduces some restrictions: -1. $(D fun) must be @safe or @trusted. +1. `fun` must be @safe or @trusted. -2. $(D F) must not have any unshared aliasing as defined by +2. `F` must not have any unshared aliasing as defined by $(XREF traits, hasUnsharedAliasing). This means it may not be an unshared delegate or a non-shared class or struct - with overloaded $(D opCall). This also precludes accepting template + with overloaded `opCall`. This also precludes accepting template alias parameters. -3. $(D Args) must not have unshared aliasing. +3. `Args` must not have unshared aliasing. -4. $(D fun) must not return by reference. +4. `fun` must not return by reference. -5. The return type must not have unshared aliasing unless $(D fun) is - $(D pure) or the $(D Task) is executed via $(D executeInNewThread) instead - of using a $(D TaskPool). +5. The return type must not have unshared aliasing unless `fun` is + `pure` or the `Task` is executed via `executeInNewThread` instead + of using a `TaskPool`. */ @trusted auto task(F, Args...)(F fun, Args args) @@ -917,25 +917,25 @@ if(is(typeof(fun(args))) && isSafeTask!F) } /** -These functions allow the creation of $(D Task) objects on the stack rather -than the GC heap. The lifetime of a $(D Task) created by $(D scopedTask) +These functions allow the creation of `Task` objects on the stack rather +than the GC heap. The lifetime of a `Task` created by `scopedTask` cannot exceed the lifetime of the scope it was created in. -$(D scopedTask) might be preferred over $(D task): +`scopedTask` might be preferred over `task`: -1. When a $(D Task) that calls a delegate is being created and a closure +1. When a `Task` that calls a delegate is being created and a closure cannot be allocated due to objects on the stack that have scoped - destruction. The delegate overload of $(D scopedTask) takes a $(D scope) + destruction. The delegate overload of `scopedTask` takes a `scope` delegate. 2. As a micro-optimization, to avoid the heap allocation associated with - $(D task) or with the creation of a closure. + `task` or with the creation of a closure. -Usage is otherwise identical to $(D task). +Usage is otherwise identical to `task`. -Notes: $(D Task) objects created using $(D scopedTask) will automatically -call $(D Task.yieldForce) in their destructor if necessary to ensure -the $(D Task) is complete before the stack frame they reside on is destroyed. +Notes: `Task` objects created using `scopedTask` will automatically +call `Task.yieldForce` in their destructor if necessary to ensure +the `Task` is complete before the stack frame they reside on is destroyed. */ auto scopedTask(alias fun, Args...)(Args args) { @@ -1006,17 +1006,17 @@ shared static ~this() /** This class encapsulates a task queue and a set of worker threads. Its purpose -is to efficiently map a large number of $(D Task)s onto a smaller number of -threads. A task queue is a FIFO queue of $(D Task) objects that have been -submitted to the $(D TaskPool) and are awaiting execution. A worker thread is a -thread that executes the $(D Task) at the front of the queue when one is +is to efficiently map a large number of `Task`s onto a smaller number of +threads. A task queue is a FIFO queue of `Task` objects that have been +submitted to the `TaskPool` and are awaiting execution. A worker thread is a +thread that executes the `Task` at the front of the queue when one is available and sleeps when the queue is empty. This class should usually be used via the global instantiation available via the $(XREF parallelism, taskPool) property. -Occasionally it is useful to explicitly instantiate a $(D TaskPool): +Occasionally it is useful to explicitly instantiate a `TaskPool`: -1. When you want $(D TaskPool) instances with multiple priorities, for example +1. When you want `TaskPool` instances with multiple priorities, for example a low priority pool and a high priority pool. 2. When the threads in the global task pool are waiting on a synchronization @@ -1426,11 +1426,11 @@ public: } /** - Default constructor that initializes a $(D TaskPool) with - $(D totalCPUs) - 1 worker threads. The minus 1 is included because the + Default constructor that initializes a `TaskPool` with + `totalCPUs` - 1 worker threads. The minus 1 is included because the main thread will also be available to do work. - Note: On single-core machines, the primitives provided by $(D TaskPool) + Note: On single-core machines, the primitives provided by `TaskPool` operate transparently in single-threaded mode. */ this() @trusted @@ -1470,17 +1470,17 @@ public: /** Implements a parallel foreach loop over a range. This works by implicitly - creating and submitting one $(D Task) to the $(D TaskPool) for each worker - thread. A work unit is a set of consecutive elements of $(D range) to + creating and submitting one `Task` to the `TaskPool` for each worker + thread. A work unit is a set of consecutive elements of `range` to be processed by a worker thread between communication with any other thread. The number of elements processed per work unit is controlled by the - $(D workUnitSize) parameter. Smaller work units provide better load + `workUnitSize` parameter. Smaller work units provide better load balancing, but larger work units avoid the overhead of communicating with other threads frequently to fetch the next work unit. Large work units also avoid false sharing in cases where the range is being modified. The less time a single iteration of the loop takes, the larger - $(D workUnitSize) should be. For very expensive loop bodies, - $(D workUnitSize) should be 1. An overload that chooses a default work + `workUnitSize` should be. For very expensive loop bodies, + `workUnitSize` should be 1. An overload that chooses a default work unit size is also available. Examples: @@ -1514,18 +1514,18 @@ public: Notes: The memory usage of this implementation is guaranteed to be constant - in $(D range.length). + in `range.length`. Breaking from a parallel foreach loop via a break, labeled break, labeled continue, return or goto statement throws a - $(D ParallelForeachError). + `ParallelForeachError`. In the case of non-random access ranges, parallel foreach buffers lazily - to an array of size $(D workUnitSize) before executing the parallel portion + to an array of size `workUnitSize` before executing the parallel portion of the loop. The exception is that, if a parallel foreach is executed - over a range returned by $(D asyncBuf) or $(D map), the copying is elided - and the buffers are simply swapped. In this case $(D workUnitSize) is - ignored and the work unit size is set to the buffer size of $(D range). + over a range returned by `asyncBuf` or `map`, the copying is elided + and the buffers are simply swapped. In this case `workUnitSize` is + ignored and the work unit size is set to the buffer size of `range`. A memory barrier is guaranteed to be executed on exit from the loop, so that results produced by all threads are visible in the calling thread. @@ -1533,10 +1533,10 @@ public: $(B Exception Handling): When at least one exception is thrown from inside a parallel foreach loop, - the submission of additional $(D Task) objects is terminated as soon as + the submission of additional `Task` objects is terminated as soon as possible, in a non-deterministic manner. All executing or enqueued work units are allowed to complete. Then, all exceptions that - were thrown by any work unit are chained using $(D Throwable.next) and + were thrown by any work unit are chained using `Throwable.next` and rethrown. The order of the exception chaining is non-deterministic. */ ParallelForeach!R parallel(R)(R range, size_t workUnitSize) @@ -1570,15 +1570,15 @@ public: { /** Eager parallel map. The eagerness of this function means it has less - overhead than the lazily evaluated $(D TaskPool.map) and should be + overhead than the lazily evaluated `TaskPool.map` and should be preferred where the memory requirements of eagerness are acceptable. - $(D functions) are the functions to be evaluated, passed as template alias + `functions` are the functions to be evaluated, passed as template alias parameters in a style similar to $(XREF algorithm, map). The first argument must be a random access range. For performance reasons, amap will assume the range elements have not yet been initialized. Elements will be overwritten without calling a destructor nor doing an assignment. As such, the range must not contain meaningful data: either un-initialized objects, or - objects in their $(D .init) state. + objects in their `.init` state. --- auto numbers = iota(100_000_000.0); @@ -1593,7 +1593,7 @@ public: --- Immediately after the range argument, an optional work unit size argument - may be provided. Work units as used by $(D amap) are identical to those + may be provided. Work units as used by `amap` are identical to those defined for parallel foreach. If no work unit size is provided, the default work unit size is used. @@ -1638,15 +1638,15 @@ public: To parallelize the copying of a range with expensive to evaluate elements to an array, pass an identity function (a function that just returns - whatever argument is provided to it) to $(D amap). + whatever argument is provided to it) to `amap`. $(B Exception Handling): When at least one exception is thrown from inside the map functions, - the submission of additional $(D Task) objects is terminated as soon as + the submission of additional `Task` objects is terminated as soon as possible, in a non-deterministic manner. All currently executing or enqueued work units are allowed to complete. Then, all exceptions that - were thrown from any work unit are chained using $(D Throwable.next) and + were thrown from any work unit are chained using `Throwable.next` and rethrown. The order of the exception chaining is non-deterministic. */ auto amap(Args...)(Args args) @@ -1765,8 +1765,8 @@ public: { /** A semi-lazy parallel map that can be used for pipelining. The map - functions are evaluated for the first $(D bufSize) elements and stored in a - buffer and made available to $(D popFront). Meanwhile, in the + functions are evaluated for the first `bufSize` elements and stored in a + buffer and made available to `popFront`. Meanwhile, in the background a second buffer of the same size is filled. When the first buffer is exhausted, it is swapped with the second buffer and filled while the values from what was originally the second buffer are read. This @@ -1774,36 +1774,36 @@ public: the need for atomic operations or synchronization for each write, and enables the mapping function to be evaluated efficiently in parallel. - $(D map) has more overhead than the simpler procedure used by $(D amap) + `map` has more overhead than the simpler procedure used by `amap` but avoids the need to keep all results in memory simultaneously and works with non-random access ranges. Params: - source = The input range to be mapped. If $(D source) is not random - access it will be lazily buffered to an array of size $(D bufSize) before + source = The input range to be mapped. If `source` is not random + access it will be lazily buffered to an array of size `bufSize` before the map function is evaluated. (For an exception to this rule, see Notes.) bufSize = The size of the buffer to store the evaluated elements. workUnitSize = The number of elements to evaluate in a single - $(D Task). Must be less than or equal to $(D bufSize), and - should be a fraction of $(D bufSize) such that all worker threads can be + `Task`. Must be less than or equal to `bufSize`, and + should be a fraction of `bufSize` such that all worker threads can be used. If the default of size_t.max is used, workUnitSize will be set to the pool-wide default. Returns: An input range representing the results of the map. This range - has a length iff $(D source) has a length. + has a length iff `source` has a length. Notes: - If a range returned by $(D map) or $(D asyncBuf) is used as an input to - $(D map), then as an optimization the copying from the output buffer + If a range returned by `map` or `asyncBuf` is used as an input to + `map`, then as an optimization the copying from the output buffer of the first range to the input buffer of the second range is elided, even - though the ranges returned by $(D map) and $(D asyncBuf) are non-random - access ranges. This means that the $(D bufSize) parameter passed to the - current call to $(D map) will be ignored and the size of the buffer - will be the buffer size of $(D source). + though the ranges returned by `map` and `asyncBuf` are non-random + access ranges. This means that the `bufSize` parameter passed to the + current call to `map` will be ignored and the size of the buffer + will be the buffer size of `source`. Examples: --- @@ -1826,11 +1826,11 @@ public: $(B Exception Handling): - Any exceptions thrown while iterating over $(D source) - or computing the map function are re-thrown on a call to $(D popFront) or, + Any exceptions thrown while iterating over `source` + or computing the map function are re-thrown on a call to `popFront` or, if thrown during construction, are simply allowed to propagate to the caller. In the case of exceptions thrown while computing the map function, - the exceptions are chained as in $(D TaskPool.amap). + the exceptions are chained as in `TaskPool.amap`. */ auto map(S)(S source, size_t bufSize = 100, size_t workUnitSize = size_t.max) @@ -2098,13 +2098,13 @@ public: } /** - Given a $(D source) range that is expensive to iterate over, returns an + Given a `source` range that is expensive to iterate over, returns an input range that asynchronously buffers the contents of - $(D source) into a buffer of $(D bufSize) elements in a worker thread, + `source` into a buffer of `bufSize` elements in a worker thread, while making previously buffered elements from a second buffer, also of size - $(D bufSize), available via the range interface of the returned - object. The returned range has a length iff $(D hasLength!S). - $(D asyncBuf) is useful, for example, when performing expensive operations + `bufSize`, available via the range interface of the returned + object. The returned range has a length iff `hasLength!S`. + `asyncBuf` is useful, for example, when performing expensive operations on the elements of ranges that represent data on a disk or network. Examples: @@ -2136,8 +2136,8 @@ public: $(B Exception Handling): - Any exceptions thrown while iterating over $(D source) are re-thrown on a - call to $(D popFront) or, if thrown during construction, simply + Any exceptions thrown while iterating over `source` are re-thrown on a + call to `popFront` or, if thrown during construction, simply allowed to propagate to the caller. */ auto asyncBuf(S)(S source, size_t bufSize = 100) if(isInputRange!S) @@ -2278,30 +2278,30 @@ public: } /** - Given a callable object $(D next) that writes to a user-provided buffer and - a second callable object $(D empty) that determines whether more data is - available to write via $(D next), returns an input range that - asynchronously calls $(D next) with a set of size $(D nBuffers) of buffers + Given a callable object `next` that writes to a user-provided buffer and + a second callable object `empty` that determines whether more data is + available to write via `next`, returns an input range that + asynchronously calls `next` with a set of size `nBuffers` of buffers and makes the results available in the order they were obtained via the input range interface of the returned object. Similarly to the - input range overload of $(D asyncBuf), the first half of the buffers + input range overload of `asyncBuf`, the first half of the buffers are made available via the range interface while the second half are filled and vice-versa. Params: next = A callable object that takes a single argument that must be an array - with mutable elements. When called, $(D next) writes data to + with mutable elements. When called, `next` writes data to the array provided by the caller. empty = A callable object that takes no arguments and returns a type - implicitly convertible to $(D bool). This is used to signify - that no more data is available to be obtained by calling $(D next). + implicitly convertible to `bool`. This is used to signify + that no more data is available to be obtained by calling `next`. - initialBufSize = The initial size of each buffer. If $(D next) takes its + initialBufSize = The initial size of each buffer. If `next` takes its array by reference, it may resize the buffers. - nBuffers = The number of buffers to cycle through when calling $(D next). + nBuffers = The number of buffers to cycle through when calling `next`. Examples: --- @@ -2330,8 +2330,8 @@ public: $(B Exception Handling): - Any exceptions thrown while iterating over $(D range) are re-thrown on a - call to $(D popFront). + Any exceptions thrown while iterating over `range` are re-thrown on a + call to `popFront`. Warning: @@ -2362,15 +2362,15 @@ public: Therefore, care must be taken to choose the seed value appropriately. Because the reduction is being performed in parallel, - $(D functions) must be associative. For notational simplicity, let # be an - infix operator representing $(D functions). Then, (a # b) # c must equal + `functions` must be associative. For notational simplicity, let # be an + infix operator representing `functions`. Then, (a # b) # c must equal a # (b # c). Floating point addition is not associative even though addition in exact arithmetic is. Summing floating point numbers using this function may give different results than summing serially. However, for many practical purposes floating point addition can be treated as associative. - Note that, since $(D functions) are assumed to be associative, additional + Note that, since `functions` are assumed to be associative, additional optimizations are made to the serial portion of the reduction algorithm. These take advantage of the instruction level parallelism of modern CPUs, in addition to the thread-level parallelism that the rest of this @@ -2410,7 +2410,7 @@ public: An explicit work unit size may be specified as the last argument. Specifying too small a work unit size will effectively serialize the reduction, as the final reduction of the result of each work unit will - dominate computation time. If $(D TaskPool.size) for this instance + dominate computation time. If `TaskPool.size` for this instance is zero, this parameter is ignored and one work unit is used. --- // Use a work unit size of 100. @@ -2421,7 +2421,7 @@ public: --- Parallel reduce supports multiple functions, like - $(D std.algorithm.reduce). + `std.algorithm.reduce`. --- // Find both the min and max of nums. auto minMax = taskPool.reduce!(min, max)(nums); @@ -2432,7 +2432,7 @@ public: $(B Exception Handling): After this function is finished executing, any exceptions thrown - are chained together via $(D Throwable.next) and rethrown. The chaining + are chained together via `Throwable.next` and rethrown. The chaining order is non-deterministic. */ auto reduce(Args...)(Args args) @@ -2728,9 +2728,9 @@ public: } /** - Gets the index of the current thread relative to this $(D TaskPool). Any + Gets the index of the current thread relative to this `TaskPool`. Any thread not in this pool will receive an index of 0. The worker threads in - this pool receive unique indices of 1 through $(D this.size). + this pool receive unique indices of 1 through `this.size`. This function is useful for maintaining worker-local resources. @@ -2776,21 +2776,21 @@ public: /** Struct for creating worker-local storage. Worker-local storage is thread-local storage that exists only for worker threads in a given - $(D TaskPool) plus a single thread outside the pool. It is allocated on the + `TaskPool` plus a single thread outside the pool. It is allocated on the garbage collected heap in a way that avoids _false sharing, and doesn't necessarily have global scope within any thread. It can be accessed from - any worker thread in the $(D TaskPool) that created it, and one thread - outside this $(D TaskPool). All threads outside the pool that created a + any worker thread in the `TaskPool` that created it, and one thread + outside this `TaskPool`. All threads outside the pool that created a given instance of worker-local storage share a single slot. Since the underlying data for this struct is heap-allocated, this struct has reference semantics when passed between functions. - The main uses cases for $(D WorkerLocalStorageStorage) are: + The main uses cases for `WorkerLocalStorageStorage` are: 1. Performing parallel reductions with an imperative, as opposed to functional, programming style. In this case, it's useful to treat - $(D WorkerLocalStorageStorage) as local to each thread for only the parallel + `WorkerLocalStorageStorage` as local to each thread for only the parallel portion of an algorithm. 2. Recycling temporary buffers across iterations of a parallel foreach loop. @@ -2900,13 +2900,13 @@ public: public: /** Get the current thread's instance. Returns by ref. - Note that calling $(D get) from any thread - outside the $(D TaskPool) that created this instance will return the + Note that calling `get` from any thread + outside the `TaskPool` that created this instance will return the same reference, so an instance of worker-local storage should only be accessed from one thread outside the pool that created it. If this rule is violated, undefined behavior will result. - If assertions are enabled and $(D toRange) has been called, then this + If assertions are enabled and `toRange` has been called, then this WorkerLocalStorage instance is no longer worker-local and an assertion failure will result when calling this method. This is not checked when assertions are disabled for performance reasons. @@ -2941,7 +2941,7 @@ public: of your algorithm. Calling this function sets a flag indicating that this struct is no - longer worker-local, and attempting to use the $(D get) method again + longer worker-local, and attempting to use the `get` method again will result in an assertion failure if assertions are enabled. */ WorkerLocalStorageRange!T toRange() @property @@ -2971,9 +2971,9 @@ public: Do not use this struct in the parallel portion of your algorithm. The proper way to instantiate this object is to call - $(D WorkerLocalStorage.toRange). Once instantiated, this object behaves + `WorkerLocalStorage.toRange`. Once instantiated, this object behaves as a finite random-access range with assignable, lvalue elements and - a length equal to the number of worker threads in the $(D TaskPool) that + a length equal to the number of worker threads in the `TaskPool` that created it plus 1. */ static struct WorkerLocalStorageRange(T) @@ -3057,9 +3057,9 @@ public: /** Creates an instance of worker-local storage, initialized with a given - value. The value is $(D lazy) so that you can, for example, easily + value. The value is `lazy` so that you can, for example, easily create one instance of a class for each worker. For usage example, - see the $(D WorkerLocalStorage) struct. + see the `WorkerLocalStorage` struct. */ WorkerLocalStorage!T workerLocalStorage(T)(lazy T initialVal = T.init) { @@ -3080,12 +3080,12 @@ public: /** Signals to all worker threads to terminate as soon as they are finished - with their current $(D Task), or immediately if they are not executing a - $(D Task). $(D Task)s that were in queue will not be executed unless - a call to $(D Task.workForce), $(D Task.yieldForce) or $(D Task.spinForce) + with their current `Task`, or immediately if they are not executing a + `Task`. `Task`s that were in queue will not be executed unless + a call to `Task.workForce`, `Task.yieldForce` or `Task.spinForce` causes them to be executed. - Use only if you have waited on every $(D Task) and therefore know the + Use only if you have waited on every `Task` and therefore know the queue is empty, or if you speculatively executed some tasks and no longer need the results. */ @@ -3102,13 +3102,13 @@ public: If blocking argument is true, wait for all worker threads to terminate before returning. This option might be used in applications where - task results are never consumed-- e.g. when $(D TaskPool) is employed as a + task results are never consumed-- e.g. when `TaskPool` is employed as a rudimentary scheduler for tasks which communicate by means other than return values. Warning: Calling this function with $(D blocking = true) from a worker - thread that is a member of the same $(D TaskPool) that - $(D finish) is being called on will result in a deadlock. + thread that is a member of the same `TaskPool` that + `finish` is being called on will result in a deadlock. */ void finish(bool blocking = false) @trusted { @@ -3147,7 +3147,7 @@ public: } /** - Put a $(D Task) object on the back of the task queue. The $(D Task) + Put a `Task` object on the back of the task queue. The `Task` object may be passed by pointer or reference. Example: @@ -3163,20 +3163,20 @@ public: Notes: - @trusted overloads of this function are called for $(D Task)s if - $(XREF traits, hasUnsharedAliasing) is false for the $(D Task)'s - return type or the function the $(D Task) executes is $(D pure). - $(D Task) objects that meet all other requirements specified in the - $(D @trusted) overloads of $(D task) and $(D scopedTask) may be created - and executed from $(D @safe) code via $(D Task.executeInNewThread) but - not via $(D TaskPool). + @trusted overloads of this function are called for `Task`s if + $(XREF traits, hasUnsharedAliasing) is false for the `Task`'s + return type or the function the `Task` executes is `pure`. + `Task` objects that meet all other requirements specified in the + `@trusted` overloads of `task` and `scopedTask` may be created + and executed from `@safe` code via `Task.executeInNewThread` but + not via `TaskPool`. While this function takes the address of variables that may be on the stack, some overloads are marked as @trusted. - $(D Task) includes a destructor that waits for the task to complete + `Task` includes a destructor that waits for the task to complete before destroying the stack frame it is allocated on. Therefore, it is impossible for the stack frame to be destroyed before the task is - complete and no longer referenced by a $(D TaskPool). + complete and no longer referenced by a `TaskPool`. */ void put(alias fun, Args...)(ref Task!(fun, Args) task) if(!isSafeReturn!(typeof(task))) @@ -3213,11 +3213,11 @@ public: have terminated. A non-daemon thread will prevent a program from terminating as long as it has not terminated. - If any $(D TaskPool) with non-daemon threads is active, either $(D stop) - or $(D finish) must be called on it before the program can terminate. + If any `TaskPool` with non-daemon threads is active, either `stop` + or `finish` must be called on it before the program can terminate. - The worker treads in the $(D TaskPool) instance returned by the - $(D taskPool) property are daemon by default. The worker threads of + The worker treads in the `TaskPool` instance returned by the + `taskPool` property are daemon by default. The worker threads of manually instantiated task pools are non-daemon by default. Note: For a size zero pool, the getter arbitrarily returns true and the @@ -3243,9 +3243,9 @@ public: /** These functions allow getting and setting the OS scheduling priority of - the worker threads in this $(D TaskPool). They forward to - $(D core.thread.Thread.priority), so a given priority value here means the - same thing as an identical priority value in $(D core.thread). + the worker threads in this `TaskPool`. They forward to + `core.thread.Thread.priority`, so a given priority value here means the + same thing as an identical priority value in `core.thread`. Note: For a size zero pool, the getter arbitrarily returns $(D core.thread.Thread.PRIORITY_MIN) and the setter has no effect. @@ -3270,10 +3270,10 @@ public: } /** -Returns a lazily initialized global instantiation of $(D TaskPool). +Returns a lazily initialized global instantiation of `TaskPool`. This function can safely be called concurrently from multiple non-worker threads. The worker threads in this pool are daemon threads, meaning that it -is not necessary to call $(D TaskPool.stop) or $(D TaskPool.finish) before +is not necessary to call `TaskPool.stop` or `TaskPool.finish` before terminating the main thread. */ @property TaskPool taskPool() @trusted @@ -3305,10 +3305,10 @@ shared static this() } /** -These properties get and set the number of worker threads in the $(D TaskPool) -instance returned by $(D taskPool). The default value is $(D totalCPUs) - 1. -Calling the setter after the first call to $(D taskPool) does not changes -number of worker threads in the instance returned by $(D taskPool). +These properties get and set the number of worker threads in the `TaskPool` +instance returned by `taskPool`. The default value is `totalCPUs` - 1. +Calling the setter after the first call to `taskPool` does not changes +number of worker threads in the instance returned by `taskPool`. */ @property uint defaultPoolThreads() @trusted { @@ -3322,7 +3322,7 @@ number of worker threads in the instance returned by $(D taskPool). } /** -Convenience functions that forwards to $(D taskPool.parallel). The +Convenience functions that forwards to `taskPool.parallel`. The purpose of these is to make parallel foreach less verbose and more readable. diff --git a/std/path.d b/std/path.d index 254d8f0001c..ec55e8d0262 100644 --- a/std/path.d +++ b/std/path.d @@ -34,7 +34,7 @@ Upgrading: $(WEB digitalmars.com/d/1.0/phobos/std_path.html#fnmatch) can - be replaced with $(D globMatch). + be replaced with `globMatch`. Authors: Lars Tandle Kyllingstad, @@ -206,7 +206,7 @@ private auto trimDirSeparators(R)(inout R path) -/** This $(D enum) is used as a template argument to functions which +/** This `enum` is used as a template argument to functions which compare file names, and determines whether the comparison is case sensitive or not. */ @@ -219,7 +219,7 @@ enum CaseSensitive : bool yes = true, /** The default (or most common) setting for the current platform. - That is, $(D no) on Windows and Mac OS X, and $(D yes) on all + That is, `no` on Windows and Mac OS X, and `yes` on all POSIX systems except OS X (Linux, *BSD, etc.). */ osDefault = osDefaultCaseSensitivity @@ -235,9 +235,9 @@ else static assert (0); /** Returns the name of a file, without any leading directory and with an optional suffix chopped off. - If $(D suffix) is specified, it will be compared to $(D path) - using $(D filenameCmp!cs), - where $(D cs) is an optional template parameter determining whether + If `suffix` is specified, it will be compared to `path` + using `filenameCmp!cs`, + where `cs` is an optional template parameter determining whether the comparison is case sensitive or not. See the $(LREF filenameCmp) documentation for details. @@ -379,9 +379,9 @@ unittest /** Returns the directory part of a path. On Windows, this includes the drive letter if present. - This function performs a memory allocation if and only if $(D path) + This function performs a memory allocation if and only if `path` does not have a directory (in which case a new string is needed to - hold the returned current-directory symbol, $(D ".")). + hold the returned current-directory symbol, `"."`). Examples: --- @@ -482,7 +482,7 @@ unittest -/** Returns the root directory of the specified path, or $(D null) if the +/** Returns the root directory of the specified path, or `null` if the path is not rooted. Examples: @@ -545,11 +545,11 @@ unittest -/** Returns the drive of a path, or $(D null) if the drive +/** Returns the drive of a path, or `null` if the drive is not specified. In the case of UNC paths, the network share is returned. - Always returns $(D null) on POSIX. + Always returns `null` on POSIX. Examples: --- @@ -666,7 +666,7 @@ private ptrdiff_t extSeparatorPos(R)(const R path) /** Returns the _extension part of a file name, including the dot. - If there is no _extension, $(D null) is returned. + If there is no _extension, `null` is returned. Examples: --- @@ -802,12 +802,12 @@ unittest -/** Returns a string containing the _path given by $(D path), but where - the extension has been set to $(D ext). +/** Returns a string containing the _path given by `path`, but where + the extension has been set to `ext`. If the filename already has an extension, it is replaced. If not, the extension is simply appended to the filename. Including a leading dot - in $(D ext) is optional. + in `ext` is optional. If the extension is empty, this function is equivalent to $(LREF stripExtension). @@ -893,8 +893,8 @@ unittest -/** Returns the _path given by $(D path), with the extension given by - $(D ext) appended if the path doesn't already have one. +/** Returns the _path given by `path`, with the extension given by + `ext` appended if the path doesn't already have one. Including the dot in the extension is optional. @@ -961,7 +961,7 @@ unittest This function always allocates memory to hold the resulting path. The variadic overload is guaranteed to only perform a single - allocation, as is the range version if $(D paths) is a forward + allocation, as is the range version if `paths` is a forward range. */ immutable(ElementEncodingType!(ElementType!Range))[] @@ -1144,7 +1144,7 @@ unittest /** Performs the same task as $(LREF buildPath), while at the same time resolving current/parent directory - symbols ($(D ".") and $(D "..")) and removing superfluous + symbols (`"."` and `".."`) and removing superfluous directory separators. It will return "." if the path leads to the starting directory. On Windows, slashes are replaced with backslashes. @@ -1928,7 +1928,7 @@ unittest On Windows, an absolute path starts at the root directory of a specific drive. Hence, it must start with $(D `d:\`) or $(D `d:/`), - where $(D d) is the drive letter. Alternatively, it may be a + where `d` is the drive letter. Alternatively, it may be a network path, i.e. a path starting with a double (back)slash. --- version (Windows) @@ -2000,14 +2000,14 @@ unittest -/** Translates $(D path) into an absolute _path. +/** Translates `path` into an absolute _path. The following algorithm is used: $(OL - $(LI If $(D path) is empty, return $(D null).) - $(LI If $(D path) is already absolute, return it.) - $(LI Otherwise, append $(D path) to $(D base) and return - the result. If $(D base) is not specified, the current + $(LI If `path` is empty, return `null`.) + $(LI If `path` is already absolute, return it.) + $(LI Otherwise, append `path` to `base` and return + the result. If `base` is not specified, the current working directory is used.) ) The function allocates memory if and only if it gets to the third stage @@ -2032,7 +2032,7 @@ unittest --- Throws: - $(D Exception) if the specified _base directory is not absolute. + `Exception` if the specified _base directory is not absolute. */ string absolutePath(string path, lazy string base = getcwd()) @safe pure @@ -2072,27 +2072,27 @@ unittest -/** Translates $(D path) into a relative _path. +/** Translates `path` into a relative _path. - The returned _path is relative to $(D base), which is by default + The returned _path is relative to `base`, which is by default taken to be the current working directory. If specified, - $(D base) must be an absolute _path, and it is always assumed - to refer to a directory. If $(D path) and $(D base) refer to + `base` must be an absolute _path, and it is always assumed + to refer to a directory. If `path` and `base` refer to the same directory, the function returns $(D `.`). The following algorithm is used: $(OL - $(LI If $(D path) is a relative directory, return it unaltered.) - $(LI Find a common root between $(D path) and $(D base). - If there is no common root, return $(D path) unaltered.) + $(LI If `path` is a relative directory, return it unaltered.) + $(LI Find a common root between `path` and `base`. + If there is no common root, return `path` unaltered.) $(LI Prepare a string with as many $(D `../`) or $(D `..\`) as necessary to reach the common root from base path.) - $(LI Append the remaining segments of $(D path) to the string + $(LI Append the remaining segments of `path` to the string and return.) ) - In the second step, path components are compared using $(D filenameCmp!cs), - where $(D cs) is an optional template parameter determining whether + In the second step, path components are compared using `filenameCmp!cs`, + where `cs` is an optional template parameter determining whether the comparison is case sensitive or not. See the $(LREF filenameCmp) documentation for details. @@ -2123,7 +2123,7 @@ unittest --- Throws: - $(D Exception) if the specified _base directory is not absolute. + `Exception` if the specified _base directory is not absolute. */ string relativePath(CaseSensitive cs = CaseSensitive.osDefault) (string path, lazy string base = getcwd()) @@ -2215,13 +2215,13 @@ unittest -/** Compares filename characters and return $(D < 0) if $(D a < b), $(D 0) if +/** Compares filename characters and return $(D < 0) if $(D a < b), `0` if $(D a == b) and $(D > 0) if $(D a > b). This function can perform a case-sensitive or a case-insensitive - comparison. This is controlled through the $(D cs) template parameter + comparison. This is controlled through the `cs` template parameter which, if not specified, is given by - $(LREF CaseSensitive)$(D .osDefault). + $(LREF CaseSensitive)`.osDefault`. On Windows, the backslash and slash characters ($(D `\`) and $(D `/`)) are considered equal. @@ -2288,11 +2288,11 @@ unittest /** Compares file names and returns $(D < 0) if $(D filename1 < filename2), - $(D 0) if $(D filename1 == filename2) and + `0` if $(D filename1 == filename2) and $(D > 0) if $(D filename1 > filename2). - Individual characters are compared using $(D filenameCharCmp!cs), - where $(D cs) is an optional template parameter determining whether + Individual characters are compared using `filenameCharCmp!cs`, + where `cs` is an optional template parameter determining whether the comparison is case sensitive or not. See the $(LREF filenameCharCmp) documentation for details. @@ -2371,22 +2371,22 @@ unittest $(I meta-characters)) and can't be escaped. These are: $(BOOKTABLE, - $(TR $(TD $(D *)) + $(TR $(TD `*`) $(TD Matches 0 or more instances of any character.)) - $(TR $(TD $(D ?)) + $(TR $(TD `?`) $(TD Matches exactly one instance of any character.)) - $(TR $(TD $(D [)$(I chars)$(D ])) + $(TR $(TD `[`$(I chars)`]`) $(TD Matches one instance of any character that appears between the brackets.)) - $(TR $(TD $(D [!)$(I chars)$(D ])) + $(TR $(TD `[!`$(I chars)`]`) $(TD Matches one instance of any character that does not appear between the brackets after the exclamation mark.)) - $(TR $(TD $(D {)$(I string1)$(D ,)$(I string2)$(D ,)…$(D })) + $(TR $(TD `{`$(I string1)`,`$(I string2)`,`…`}`) $(TD Matches either of the specified strings.)) ) - Individual characters are compared using $(D filenameCharCmp!cs), - where $(D cs) is an optional template parameter determining whether + Individual characters are compared using `filenameCharCmp!cs`, + where `cs` is an optional template parameter determining whether the comparison is case sensitive or not. See the $(LREF filenameCharCmp) documentation for details. @@ -2395,7 +2395,7 @@ unittest further portions of the path. Returns: - $(D true) if pattern matches path, $(D false) otherwise. + `true` if pattern matches path, `false` otherwise. See_also: $(LINK2 http://en.wikipedia.org/wiki/Glob_%28programming%29,Wikipedia: _glob (programming)) @@ -2595,28 +2595,28 @@ unittest /** Checks that the given file or directory name is valid. - This function returns $(D true) if and only if $(D filename) is not + This function returns `true` if and only if `filename` is not empty, not too long, and does not contain invalid characters. - The maximum length of $(D filename) is given by the constant + The maximum length of `filename` is given by the constant $(D core.stdc.stdio.FILENAME_MAX). (On Windows, this number is defined as the maximum number of UTF-16 code points, and the test will therefore only yield strictly correct results when - $(D filename) is a string of $(D wchar)s.) + `filename` is a string of `wchar`s.) On Windows, the following criteria must be satisfied ($(LINK2 http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx,source)): $(UL - $(LI $(D filename) must not contain any characters whose integer + $(LI `filename` must not contain any characters whose integer representation is in the range 0-31.) - $(LI $(D filename) must not contain any of the following $(I reserved + $(LI `filename` must not contain any of the following $(I reserved characters): <>:"/\|?*) - $(LI $(D filename) may not end with a space ($(D ' ')) or a period - ($(D '.')).) + $(LI `filename` may not end with a space ($(D ' ')) or a period + (`'.'`).) ) - On POSIX, $(D filename) may not contain a forward slash ($(D '/')) or - the null character ($(D '\0')). + On POSIX, `filename` may not contain a forward slash (`'/'`) or + the null character (`'\0'`). */ bool isValidFilename(R)(R filename) if (isRandomAccessRange!R && isSomeChar!(ElementType!R) || @@ -2697,27 +2697,27 @@ unittest -/** Checks whether $(D path) is a valid _path. +/** Checks whether `path` is a valid _path. - Generally, this function checks that $(D path) is not empty, and that + Generally, this function checks that `path` is not empty, and that each component of the path either satisfies $(LREF isValidFilename) - or is equal to $(D ".") or $(D ".."). + or is equal to `"."` or `".."`. It does $(I not) check whether the _path points to an existing file or directory; use $(XREF file,exists) for this purpose. On Windows, some special rules apply: $(UL - $(LI If the second character of $(D path) is a colon ($(D ':')), + $(LI If the second character of `path` is a colon (`':'`), the first character is interpreted as a drive letter, and must be in the range A-Z (case insensitive).) - $(LI If $(D path) is on the form $(D `\\$(I server)\$(I share)\...`) + $(LI If `path` is on the form $(D `\\$(I server)\$(I share)\...`) (UNC path), $(LREF isValidFilename) is applied to $(I server) and $(I share) as well.) - $(LI If $(D path) starts with $(D `\\?\`) (long UNC path), the + $(LI If `path` starts with $(D `\\?\`) (long UNC path), the only requirement for the rest of the string is that it does not contain the null character.) - $(LI If $(D path) starts with $(D `\\.\`) (Win32 device namespace) - this function returns $(D false); such paths are beyond the scope + $(LI If `path` starts with $(D `\\.\`) (Win32 device namespace) + this function returns `false`; such paths are beyond the scope of this module.) ) */ @@ -2855,16 +2855,16 @@ unittest There are two ways of using tilde expansion in a path. One involves using the tilde alone or followed by a path separator. In this case, the tilde will be expanded with the value of the - environment variable $(D HOME). The second way is putting - a username after the tilde (i.e. $(D ~john/Mail)). Here, + environment variable `HOME`. The second way is putting + a username after the tilde (i.e. `~john/Mail`). Here, the username will be searched for in the user database - (i.e. $(D /etc/passwd) on Unix systems) and will expand to + (i.e. `/etc/passwd` on Unix systems) and will expand to whatever path is stored there. The username is considered the string after the tilde ending at the first instance of a path separator. - Note that using the $(D ~user) syntax may give different - values from just $(D ~) if the environment variable doesn't + Note that using the `~user` syntax may give different + values from just `~` if the environment variable doesn't match the value stored in the user database. When the environment variable version is used, the path won't @@ -2876,9 +2876,9 @@ unittest This function performs several memory allocations. Returns: - $(D inputPath) with the tilde expanded, or just $(D inputPath) + `inputPath` with the tilde expanded, or just `inputPath` if it could not be expanded. - For Windows, $(D expandTilde) merely returns its argument $(D inputPath). + For Windows, `expandTilde` merely returns its argument `inputPath`. Examples: ----- diff --git a/std/process.d b/std/process.d index 93375b2bc31..d8fb9d7cfbd 100644 --- a/std/process.d +++ b/std/process.d @@ -10,13 +10,13 @@ $(UL $(LI arbitrary set of standard input, output, and error streams. The function returns immediately, leaving the child _process to execute in parallel with its parent. All other functions in this module that - spawn processes are built around $(D spawnProcess).) + spawn processes are built around `spawnProcess`.) $(LI $(LREF wait) makes the parent _process wait for a child _process to terminate. In general one should always do this, to avoid child processes becoming "zombies" when the parent _process exits. Scope guards are perfect for this – see the $(LREF spawnProcess) - documentation for examples. $(LREF tryWait) is similar to $(D wait), + documentation for examples. $(LREF tryWait) is similar to `wait`, but does not block if the _process has not yet terminated.) $(LI $(LREF pipeProcess) also spawns a child _process which runs @@ -24,7 +24,7 @@ $(LI arbitrary streams, it automatically creates a set of pipes that allow the parent to communicate with the child through the child's standard input, output, and/or error streams. - This function corresponds roughly to C's $(D popen) function.) + This function corresponds roughly to C's `popen` function.) $(LI $(LREF execute) starts a new _process and waits for it to complete before returning. Additionally, it captures @@ -32,10 +32,10 @@ $(LI the output of these as a string.) $(LI $(LREF spawnShell), $(LREF pipeShell) and $(LREF executeShell) work like - $(D spawnProcess), $(D pipeProcess) and $(D execute), respectively, + `spawnProcess`, `pipeProcess` and `execute`, respectively, except that they take a single command string and run it through the current user's default command interpreter. - $(D executeShell) corresponds roughly to C's $(D system) function.) + `executeShell` corresponds roughly to C's `system` function.) $(LI $(LREF kill) attempts to terminate a running _process.) ) @@ -172,18 +172,18 @@ input, output, and error streams. The function returns immediately, leaving the child _process to execute in parallel with its parent. It is recommended to always call $(LREF wait) -on the returned $(LREF Pid), as detailed in the documentation for $(D wait). +on the returned $(LREF Pid), as detailed in the documentation for `wait`. Command_line: There are four overloads of this function. The first two take an array -of strings, $(D args), which should contain the program name as the +of strings, `args`, which should contain the program name as the zeroth element and any command-line arguments in subsequent elements. The third and fourth versions are included for convenience, and may be used when there are no command-line arguments. They take a single string, -$(D program), which specifies the program name. +`program`, which specifies the program name. -Unless a directory is specified in $(D args[0]) or $(D program), -$(D spawnProcess) will search for the program in a platform-dependent +Unless a directory is specified in `args[0]` or `program`, +`spawnProcess` will search for the program in a platform-dependent manner. On POSIX systems, it will look for the executable in the directories listed in the PATH environment variable, in the order they are listed. On Windows, it will search for the executable in @@ -213,19 +213,19 @@ if (wait(dmdPid) != 0) Environment_variables: By default, the child process inherits the environment of the parent -process, along with any additional variables specified in the $(D env) +process, along with any additional variables specified in the `env` parameter. If the same variable exists in both the parent's environment -and in $(D env), the latter takes precedence. +and in `env`, the latter takes precedence. -If the $(LREF Config.newEnv) flag is set in $(D config), the child +If the $(LREF Config.newEnv) flag is set in `config`, the child process will $(I not) inherit the parent's environment. Its entire -environment will then be determined by $(D env). +environment will then be determined by `env`. --- wait(spawnProcess("myapp", ["foo" : "bar"], Config.newEnv)); --- Standard_streams: -The optional arguments $(D stdin), $(D stdout) and $(D stderr) may +The optional arguments `stdin`, `stdout` and `stderr` may be used to assign arbitrary $(XREF stdio,File) objects as the standard input, output and error streams, respectively, of the child process. The former must be opened for reading, while the latter two must be opened for @@ -243,14 +243,14 @@ if (wait(pid) != 0) writeln("Compilation failed. See errors.log for details."); --- -Note that if you pass a $(D File) object that is $(I not) +Note that if you pass a `File` object that is $(I not) one of the standard input/output/error streams of the parent process, that stream will by default be $(I closed) in the parent process when this function returns. See the $(LREF Config) documentation below for information about how to disable this behaviour. -Beware of buffering issues when passing $(D File) objects to -$(D spawnProcess). The child process will inherit the low-level raw +Beware of buffering issues when passing `File` objects to +`spawnProcess`. The child process will inherit the low-level raw read/write offset associated with the underlying file descriptor, but it will not be aware of any buffered data. In cases where this matters (e.g. when a file should be aligned before being passed on to the @@ -284,7 +284,7 @@ Throws: $(LREF ProcessException) on failure to start the process.$(BR) $(XREF stdio,StdioException) on failure to pass one of the streams to the child process (Windows only).$(BR) -$(CXREF exception,RangeError) if $(D args) is empty. +$(CXREF exception,RangeError) if `args` is empty. */ Pid spawnProcess(in char[][] args, File stdin = std.stdio.stdin, @@ -912,13 +912,13 @@ unittest // Reopening the standard streams (issue 13258) A variation on $(LREF spawnProcess) that runs the given _command through the current user's preferred _command interpreter (aka. shell). -The string $(D command) is passed verbatim to the shell, and is therefore +The string `command` is passed verbatim to the shell, and is therefore subject to its rules about _command structure, argument/filename quoting and escaping of special characters. The path to the shell executable is determined by the $(LREF userShell) function. -In all other respects this function works just like $(D spawnProcess). +In all other respects this function works just like `spawnProcess`. Please refer to the $(LREF spawnProcess) documentation for descriptions of the other function parameters, the return value and any exceptions that may be thrown. @@ -1064,7 +1064,7 @@ enum Config /** On Windows, if the child process is a console application, this flag will prevent the creation of a console window. Otherwise, - it will be ignored. On POSIX, $(D suppressConsole) has no effect. + it will be ignored. On POSIX, `suppressConsole` has no effect. */ suppressConsole = 16, @@ -1074,7 +1074,7 @@ enum Config to subtle bugs when pipes or multiple threads are involved, $(LREF spawnProcess) ensures that all file descriptors except the ones that correspond to standard input/output/error are closed - in the child process when it starts. Use $(D inheritFDs) to prevent + in the child process when it starts. Use `inheritFDs` to prevent this. On Windows, this option has no effect, and any handles which have been @@ -1107,7 +1107,7 @@ final class Pid This handle is used to specify the process in OS-specific APIs. On POSIX, this function returns a $(D core.sys.posix.sys.types.pid_t) with the same value as $(LREF Pid.processID), while on Windows it returns - a $(D core.sys.windows.windows.HANDLE). + a `core.sys.windows.windows.HANDLE`. Once $(LREF wait) has been called on the $(LREF Pid), this method will return an invalid handle. @@ -1248,7 +1248,7 @@ private: /** -Waits for the process associated with $(D pid) to terminate, and returns +Waits for the process associated with `pid` to terminate, and returns its exit status. In general one should always _wait for child processes to terminate @@ -1265,8 +1265,8 @@ If the process is terminated by a signal, this function returns a negative number whose absolute value is the signal number. Since POSIX restricts normal exit codes to the range 0-255, a negative return value will always indicate termination by signal. -Signal codes are defined in the $(D core.sys.posix.signal) module -(which corresponds to the $(D signal.h) POSIX header). +Signal codes are defined in the `core.sys.posix.signal` module +(which corresponds to the `signal.h` POSIX header). Throws: $(LREF ProcessException) on failure. @@ -1305,18 +1305,18 @@ unittest // Pid and wait() /** A non-blocking version of $(LREF wait). -If the process associated with $(D pid) has already terminated, -$(D tryWait) has the exact same effect as $(D wait). -In this case, it returns a tuple where the $(D terminated) field -is set to $(D true) and the $(D status) field has the same -interpretation as the return value of $(D wait). +If the process associated with `pid` has already terminated, +`tryWait` has the exact same effect as `wait`. +In this case, it returns a tuple where the `terminated` field +is set to `true` and the `status` field has the same +interpretation as the return value of `wait`. If the process has $(I not) yet terminated, this function differs -from $(D wait) in that does not wait for this to happen, but instead -returns immediately. The $(D terminated) field of the returned -tuple will then be set to $(D false), while the $(D status) field -will always be 0 (zero). $(D wait) or $(D tryWait) should then be -called again on the same $(D Pid) at some later time; not only to +from `wait` in that does not wait for this to happen, but instead +returns immediately. The `terminated` field of the returned +tuple will then be set to `false`, while the `status` field +will always be 0 (zero). `wait` or `tryWait` should then be +called again on the same `Pid` at some later time; not only to get the exit code, but also to avoid the process becoming a "zombie" when it finally terminates. (See $(LREF wait) for details). @@ -1340,9 +1340,9 @@ if (dmd.terminated) else writeln("Still compiling..."); ... --- -Note that in this example, the first $(D wait) call will have no -effect if the process has already terminated by the time $(D tryWait) -is called. In the opposite case, however, the $(D scope) statement +Note that in this example, the first `wait` call will have no +effect if the process has already terminated by the time `tryWait` +is called. In the opposite case, however, the `scope` statement ensures that we always wait for the process if it hasn't terminated by the time we reach the end of the scope. */ @@ -1357,21 +1357,21 @@ auto tryWait(Pid pid) @safe /** -Attempts to terminate the process associated with $(D pid). +Attempts to terminate the process associated with `pid`. -The effect of this function, as well as the meaning of $(D codeOrSignal), +The effect of this function, as well as the meaning of `codeOrSignal`, is highly platform dependent. Details are given below. Common to all platforms is that this function only $(I initiates) termination of the process, and returns immediately. It does not wait for the process to end, nor does it guarantee that the process does in fact get terminated. -Always call $(LREF wait) to wait for a process to complete, even if $(D kill) +Always call $(LREF wait) to wait for a process to complete, even if `kill` has been called on it. Windows_specific: The process will be $(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/ms686714%28v=vs.100%29.aspx, -forcefully and abruptly terminated). If $(D codeOrSignal) is specified, it +forcefully and abruptly terminated). If `codeOrSignal` is specified, it must be a nonnegative number which will be used as the exit code of the process. If not, the process wil exit with code 1. Do not use $(D codeOrSignal = 259), as this is a special value (aka. $(LINK2 http://msdn.microsoft.com/en-us/library/windows/desktop/ms683189.aspx,STILL_ACTIVE)) @@ -1384,13 +1384,13 @@ assert (wait(pid) == 10); POSIX_specific: A $(LINK2 http://en.wikipedia.org/wiki/Unix_signal,signal) will be sent to -the process, whose value is given by $(D codeOrSignal). Depending on the +the process, whose value is given by `codeOrSignal`. Depending on the signal sent, this may or may not terminate the process. Symbolic constants for various $(LINK2 http://en.wikipedia.org/wiki/Unix_signal#POSIX_signals, -POSIX signals) are defined in $(D core.sys.posix.signal), which corresponds to the +POSIX signals) are defined in `core.sys.posix.signal`, which corresponds to the $(LINK2 http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html, -$(D signal.h) POSIX header). If $(D codeOrSignal) is omitted, the -$(D SIGTERM) signal will be sent. (This matches the behaviour of the +`signal.h` POSIX header). If `codeOrSignal` is omitted, the +`SIGTERM` signal will be sent. (This matches the behaviour of the $(LINK2 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/kill.html, $(D _kill)) shell command.) --- @@ -1607,16 +1607,16 @@ unittest Starts a new process, creating pipes to redirect its standard input, output and/or error streams. -$(D pipeProcess) and $(D pipeShell) are convenient wrappers around +`pipeProcess` and `pipeShell` are convenient wrappers around $(LREF spawnProcess) and $(LREF spawnShell), respectively, and automate the task of redirecting one or more of the child process' standard streams through pipes. Like the functions they wrap, these functions return immediately, leaving the child process to execute in parallel with the invoking process. It is recommended to always call $(LREF wait) on the returned $(LREF ProcessPipes.pid), -as detailed in the documentation for $(D wait). +as detailed in the documentation for `wait`. -The $(D args)/$(D program)/$(D command), $(D env) and $(D config) +The `args`/`program`/`command`, `env` and `config` parameters are forwarded straight to the underlying spawn functions, and we refer to their documentation for details. @@ -1635,7 +1635,7 @@ env = Additional environment variables for the child process. (See $(LREF spawnProcess) for details.) config = Flags that control process creation. See $(LREF Config) for an overview of available flags, and note that the - $(D retainStd...) flags have no effect in this function. + `retainStd...` flags have no effect in this function. workDir = The working directory for the new process. By default the child process inherits the parent's working directory. @@ -1817,13 +1817,13 @@ enum Redirect /** Redirect the standard error stream into the standard output stream. - This can not be combined with $(D Redirect.stderr). + This can not be combined with `Redirect.stderr`. */ stderrToStdout = 8, /** Redirect the standard output stream into the standard error stream. - This can not be combined with $(D Redirect.stdout). + This can not be combined with `Redirect.stdout`. */ stdoutToStderr = 16, } @@ -1977,7 +1977,7 @@ private: Executes the given program or shell command and returns its exit code and output. -$(D execute) and $(D executeShell) start a new process using +`execute` and `executeShell` start a new process using $(LREF spawnProcess) and $(LREF spawnShell), respectively, and wait for the process to complete before returning. The functions capture what the child process prints to both its standard output and @@ -1991,7 +1991,7 @@ if (ls.status != 0) writeln("Failed to retrieve file listing"); else writeln(ls.output); --- -The $(D args)/$(D program)/$(D command), $(D env) and $(D config) +The `args`/`program`/`command`, `env` and `config` parameters are forwarded straight to the underlying spawn functions, and we refer to their documentation for details. @@ -2007,7 +2007,7 @@ env = Additional environment variables for the child process. (See $(LREF spawnProcess) for details.) config = Flags that control process creation. See $(LREF Config) for an overview of available flags, and note that the - $(D retainStd...) flags have no effect in this function. + `retainStd...` flags have no effect in this function. maxOutput = The maximum number of bytes of output that should be captured. workDir = The working directory for the new process. @@ -2018,7 +2018,7 @@ Returns: An $(D std.typecons.Tuple!(int, "status", string, "output")). POSIX_specific: -If the process is terminated by a signal, the $(D status) field of +If the process is terminated by a signal, the `status` field of the return value will contain a negative number whose absolute value is the signal number. (See $(LREF wait) for details.) @@ -2194,11 +2194,11 @@ class ProcessException : Exception Determines the path to the current user's default command interpreter. On Windows, this function returns the contents of the COMSPEC environment -variable, if it exists. Otherwise, it returns the string $(D "cmd.exe"). +variable, if it exists. Otherwise, it returns the string `"cmd.exe"`. -On POSIX, $(D userShell) returns the contents of the SHELL environment +On POSIX, `userShell` returns the contents of the SHELL environment variable, if it exists and is non-empty. Otherwise, it returns -$(D "/bin/sh"). +`"/bin/sh"`. */ @property string userShell() @safe { @@ -2310,7 +2310,7 @@ string url = "http://dlang.org/"; executeShell(escapeShellCommand("wget", url, "-O", "dlang-index.html")); --- -Concatenate multiple $(D escapeShellCommand) and +Concatenate multiple `escapeShellCommand` and $(LREF escapeShellFileName) results to use shell redirection or piping operators. --- @@ -2805,7 +2805,7 @@ abstract final class environment { static: /** - Retrieves the value of the environment variable with the given $(D name). + Retrieves the value of the environment variable with the given `name`. --- auto path = environment["PATH"]; --- @@ -2826,7 +2826,7 @@ static: } /** - Retrieves the value of the environment variable with the given $(D name), + Retrieves the value of the environment variable with the given `name`, or a default value if the variable doesn't exist. Unlike $(LREF environment.opIndex), this function never throws. @@ -2858,8 +2858,8 @@ static: } /** - Assigns the given $(D value) to the environment variable with the given - $(D name). + Assigns the given `value` to the environment variable with the given + `name`. If the variable does not exist, it will be created. If it already exists, it will be overwritten. @@ -2899,7 +2899,7 @@ static: } /** - Removes the environment variable with the given $(D name). + Removes the environment variable with the given `name`. If the variable isn't in the environment, this function returns successfully without doing anything. @@ -2917,7 +2917,7 @@ static: Windows_specific: While Windows environment variable names are case insensitive, D's built-in associative arrays are not. This function will store all - variable names in uppercase (e.g. $(D PATH)). + variable names in uppercase (e.g. `PATH`). Throws: $(OBJECTREF Exception) if the environment variables could not @@ -3124,21 +3124,21 @@ version (unittest) /** - Execute $(D command) in a _command shell. + Execute `command` in a _command shell. $(RED Deprecated. Please use $(LREF spawnShell) or $(LREF executeShell) instead. This function will be removed in August 2015.) - Returns: If $(D command) is null, returns nonzero if the _command - interpreter is found, and zero otherwise. If $(D command) is not + Returns: If `command` is null, returns nonzero if the _command + interpreter is found, and zero otherwise. If `command` is not null, returns -1 on error, or the exit status of command (which may in turn signal an error in command's execution). Note: On Unix systems, the homonym C function (which is accessible to D programs as $(LINK2 core_stdc_stdlib.html, core.stdc.stdlib._system)) returns a code in the same format as $(LUCKY waitpid, waitpid), - meaning that C programs must use the $(D WEXITSTATUS) macro to - extract the actual exit code from the $(D system) call. D's $(D + meaning that C programs must use the `WEXITSTATUS` macro to + extract the actual exit code from the `system` call. D's $(D system) automatically extracts the exit status. */ @@ -3284,8 +3284,8 @@ private version (StdDdoc) { /** - Replaces the current process by executing a command, $(D pathname), with - the arguments in $(D argv). + Replaces the current process by executing a command, `pathname`, with + the arguments in `argv`. $(RED Deprecated on Windows. From August 2015, these functions will only be available on POSIX platforms. The reason is that they never @@ -3293,9 +3293,9 @@ version (StdDdoc) possible to implement such behaviour on Windows. See below for more information.) - Typically, the first element of $(D argv) is + Typically, the first element of `argv` is the command being executed, i.e. $(D argv[0] == pathname). The 'p' - versions of $(D exec) search the PATH environment variable for $(D + versions of `exec` search the PATH environment variable for $(D pathname). The 'e' versions additionally take the new process' environment variables as an array of strings of the form key=value. @@ -3307,7 +3307,7 @@ version (StdDdoc) These functions are only supported on POSIX platforms, as the Windows operating systems do not provide the ability to overwrite the current process image with another. In single-threaded programs it is possible - to approximate the effect of $(D execv*) by using $(LREF spawnProcess) + to approximate the effect of `execv*` by using $(LREF spawnProcess) and terminating the current process once the child process has returned. For example: --- @@ -3323,7 +3323,7 @@ version (StdDdoc) _exit(wait(spawnProcess(commandLine))); } --- - This is, however, NOT equivalent to POSIX' $(D execv*). For one thing, the + This is, however, NOT equivalent to POSIX' `execv*`. For one thing, the executed program is started as a separate process, with all this entails. Secondly, in a multithreaded program, other threads will continue to do work while the current thread is waiting for the child process to complete. @@ -3332,7 +3332,7 @@ version (StdDdoc) after spawning the child process. This is the behaviour exhibited by the $(LINK2 http://msdn.microsoft.com/en-us/library/431x4c1w.aspx,$(D __exec)) functions in Microsoft's C runtime library, and it is how D's now-deprecated - Windows $(D execv*) functions work. Example: + Windows `execv*` functions work. Example: --- auto commandLine = [ "program", "arg1", "arg2" ]; version (Posix) @@ -3570,7 +3570,7 @@ deprecated unittest } /** -Gets the value of environment variable $(D name) as a string. Calls +Gets the value of environment variable `name` as a string. Calls $(LINK2 core_stdc_stdlib.html#_getenv, core.stdc.stdlib._getenv) internally. @@ -3592,7 +3592,7 @@ string getenv(in char[] name) nothrow } /** -Sets the value of environment variable $(D name) to $(D value). If the +Sets the value of environment variable `name` to `value`. If the value was written, or the variable was already present and $(D overwrite) is false, returns normally. Otherwise, it throws an exception. Calls $(LINK2 core_sys_posix_stdlib.html#_setenv, @@ -3611,7 +3611,7 @@ else version(Posix) } /** -Removes variable $(D name) from the environment. Calls $(LINK2 +Removes variable `name` from the environment. Calls $(LINK2 core_sys_posix_stdlib.html#_unsetenv, core.sys.posix.stdlib._unsetenv) internally. $(RED Deprecated. Please use $(LREF environment.remove) instead. diff --git a/std/random.d b/std/random.d index 75496aca623..60998a1daa0 100644 --- a/std/random.d +++ b/std/random.d @@ -10,7 +10,7 @@ numbers. An overall fast and reliable means to generate random numbers is the $(D_PARAM Mt19937) generator, which derives its name from "$(LUCKY Mersenne Twister) with a period of 2 to the power of 19937". In memory-constrained situations, $(LUCKY linear congruential) -generators such as $(D MinstdRand0) and $(D MinstdRand) might be +generators such as `MinstdRand0` and `MinstdRand` might be useful. The standard library provides an alias $(D_PARAM Random) for whichever generator it considers the most fit for the target environment. @@ -33,7 +33,7 @@ integers and real numbers have been implemented. Upgrading: $(WEB digitalmars.com/d/1.0/phobos/std_random.html#rand) can - be replaced with $(D uniform!uint()). + be replaced with `uniform!uint()`. Source: $(PHOBOSSRC std/_random.d) @@ -257,7 +257,7 @@ struct LinearCongruentialEngine(UIntType, UIntType a, UIntType c, UIntType m) enum bool isUniformRandom = true; /// Does this generator have a fixed range? ($(D_PARAM true)). enum bool hasFixedRange = true; - /// Lowest generated value ($(D 1) if $(D c == 0), $(D 0) otherwise). + /// Lowest generated value (`1` if $(D c == 0), `0` otherwise). enum UIntType min = ( c == 0 ? 1 : 0 ); /// Highest generated value ($(D modulus - 1)). enum UIntType max = m - 1; @@ -349,7 +349,7 @@ The parameters of this distribution. The random number is $(D_PARAM x /** Constructs a $(D_PARAM LinearCongruentialEngine) generator seeded with -$(D x0). +`x0`. */ this(UIntType x0) @safe pure { @@ -422,7 +422,7 @@ $(D x0). } /** -Always $(D false) (random generators are infinite ranges). +Always `false` (random generators are infinite ranges). */ enum bool empty = false; @@ -439,10 +439,10 @@ Always $(D false) (random generators are infinite ranges). /** Define $(D_PARAM LinearCongruentialEngine) generators with well-chosen -parameters. $(D MinstdRand0) implements Park and Miller's "minimal +parameters. `MinstdRand0` implements Park and Miller's "minimal standard" $(WEB wikipedia.org/wiki/Park%E2%80%93Miller_random_number_generator, -generator) that uses 16807 for the multiplier. $(D MinstdRand) +generator) that uses 16807 for the multiplier. `MinstdRand` implements a variant that has slightly better spectral behavior by using the multiplier 48271. Both generators are rather simplistic. @@ -611,7 +611,7 @@ Parameters for the generator. Seeds a MersenneTwisterEngine object using an InputRange. Throws: - $(D Exception) if the InputRange didn't provide enough elements to seed the generator. + `Exception` if the InputRange didn't provide enough elements to seed the generator. The number of elements required is the 'n' template parameter of the MersenneTwisterEngine struct. Examples: @@ -706,7 +706,7 @@ Parameters for the generator. } /** -Always $(D false). +Always `false`. */ enum bool empty = false; @@ -716,7 +716,7 @@ Always $(D false). } /** -A $(D MersenneTwisterEngine) instantiated with the parameters of the +A `MersenneTwisterEngine` instantiated with the parameters of the original engine $(WEB math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html, MT19937), generating uniformly-distributed 32-bit numbers with a period of 2 to the power of 19937. Recommended for random number @@ -816,7 +816,7 @@ unittest * * Implemented according to $(WEB www.jstatsoft.org/v08/i14/paper, Xorshift RNGs). * - * $(BOOKTABLE $(TEXTWITHCOMMAS Supporting bits are below, $(D bits) means second parameter of XorshiftEngine.), + * $(BOOKTABLE $(TEXTWITHCOMMAS Supporting bits are below, `bits` means second parameter of XorshiftEngine.), * $(TR $(TH bits) $(TH period)) * $(TR $(TD 32) $(TD 2^32 - 1)) * $(TR $(TD 64) $(TD 2^64 - 1)) @@ -836,7 +836,7 @@ struct XorshiftEngine(UIntType, UIntType bits, UIntType a, UIntType b, UIntType public: ///Mark this as a Rng enum bool isUniformRandom = true; - /// Always $(D false) (random generators are infinite ranges). + /// Always `false` (random generators are infinite ranges). enum empty = false; /// Smallest generated value. enum UIntType min = 0; @@ -871,7 +871,7 @@ struct XorshiftEngine(UIntType, UIntType bits, UIntType a, UIntType b, UIntType public: /** - * Constructs a $(D XorshiftEngine) generator seeded with $(D_PARAM x0). + * Constructs a `XorshiftEngine` generator seeded with $(D_PARAM x0). */ @safe nothrow this(UIntType x0) pure @@ -1019,8 +1019,8 @@ struct XorshiftEngine(UIntType, UIntType bits, UIntType a, UIntType b, UIntType /** - * Define $(D XorshiftEngine) generators with well-chosen parameters. See each bits examples of "Xorshift RNGs". - * $(D Xorshift) is a Xorshift128's alias because 128bits implementation is mostly used. + * Define `XorshiftEngine` generators with well-chosen parameters. See each bits examples of "Xorshift RNGs". + * `Xorshift` is a Xorshift128's alias because 128bits implementation is mostly used. * * Example: * ----- @@ -1197,22 +1197,22 @@ A singleton instance of the default random number generator } /** -Generates a number between $(D a) and $(D b). The $(D boundaries) +Generates a number between `a` and `b`. The `boundaries` parameter controls the shape of the interval (open vs. closed on -either side). Valid values for $(D boundaries) are $(D "[]"), $(D -"$(LPAREN)]"), $(D "[$(RPAREN)"), and $(D "()"). The default interval +either side). Valid values for `boundaries` are `"[]"`, $(D +"$(LPAREN)]"), $(D "[$(RPAREN)"), and `"()"`. The default interval is closed to the left and open to the right. The version that does not -take $(D urng) uses the default generator $(D rndGen). +take `urng` uses the default generator `rndGen`. Params: a = lower bound of the _uniform distribution b = upper bound of the _uniform distribution urng = (optional) random number generator to use; - if not specified, defaults to $(D rndGen) + if not specified, defaults to `rndGen` Returns: A single random variate drawn from the _uniform distribution - between $(D a) and $(D b), whose type is the common type of + between `a` and `b`, whose type is the common type of these parameters Example: @@ -1560,16 +1560,16 @@ if ((isIntegral!(CommonType!(T1, T2)) || isSomeChar!(CommonType!(T1, T2))) && /** Generates a uniformly-distributed number in the range $(D [T.min, -T.max]) for any integral or character type $(D T). If no random -number generator is passed, uses the default $(D rndGen). +T.max]) for any integral or character type `T`. If no random +number generator is passed, uses the default `rndGen`. Params: urng = (optional) random number generator to use; - if not specified, defaults to $(D rndGen) + if not specified, defaults to `rndGen` Returns: Random variate drawn from the _uniform distribution across all - possible values of the integral or character type $(D T). + possible values of the integral or character type `T`. */ auto uniform(T, UniformRandomNumberGenerator) (ref UniformRandomNumberGenerator urng) @@ -1628,16 +1628,16 @@ if (!is(T == enum) && (isIntegral!T || isSomeChar!T)) } /** -Returns a uniformly selected member of enum $(D E). If no random number -generator is passed, uses the default $(D rndGen). +Returns a uniformly selected member of enum `E`. If no random number +generator is passed, uses the default `rndGen`. Params: urng = (optional) random number generator to use; - if not specified, defaults to $(D rndGen) + if not specified, defaults to `rndGen` Returns: Random variate drawn with equal probability from any - of the possible values of the enum $(D E). + of the possible values of the enum `E`. */ auto uniform(E, UniformRandomNumberGenerator) (ref UniformRandomNumberGenerator urng) @@ -1675,20 +1675,20 @@ if (is(E == enum)) /** * Generates a uniformly-distributed floating point number of type - * $(D T) in the range [0, 1$(RPAREN). If no random number generator is - * specified, the default RNG $(D rndGen) will be used as the source + * `T` in the range [0, 1$(RPAREN). If no random number generator is + * specified, the default RNG `rndGen` will be used as the source * of randomness. * - * $(D uniform01) offers a faster generation of random variates than + * `uniform01` offers a faster generation of random variates than * the equivalent $(D uniform!"[$(RPAREN)"(0.0, 1.0)) and so may be preferred * for some applications. * * Params: * urng = (optional) random number generator to use; - * if not specified, defaults to $(D rndGen) + * if not specified, defaults to `rndGen` * * Returns: - * Floating-point random variate of type $(D T) drawn from the _uniform + * Floating-point random variate of type `T` drawn from the _uniform * distribution across the half-open interval [0, 1$(RPAREN). * */ @@ -1786,9 +1786,9 @@ body } /** -Generates a uniform probability distribution of size $(D n), i.e., an -array of size $(D n) of positive numbers of type $(D F) that sum to -$(D 1). If $(D useThis) is provided, it is used as storage. +Generates a uniform probability distribution of size `n`, i.e., an +array of size `n` of positive numbers of type `F` that sum to +`1`. If `useThis` is provided, it is used as storage. */ F[] uniformDistribution(F = double)(size_t n, F[] useThis = null) if(isFloatingPoint!F) @@ -1817,14 +1817,14 @@ F[] uniformDistribution(F = double)(size_t n, F[] useThis = null) } /** -Shuffles elements of $(D r) using $(D gen) as a shuffler. $(D r) must be -a random-access range with length. If no RNG is specified, $(D rndGen) +Shuffles elements of `r` using `gen` as a shuffler. `r` must be +a random-access range with length. If no RNG is specified, `rndGen` will be used. Params: r = random-access range whose elements are to be shuffled gen = (optional) random number generator to use; if not - specified, defaults to $(D rndGen) + specified, defaults to `rndGen` */ void randomShuffle(Range, RandomGen)(Range r, ref RandomGen gen) @@ -1859,22 +1859,22 @@ unittest } /** -Partially shuffles the elements of $(D r) such that upon returning $(D r[0..n]) -is a random subset of $(D r) and is randomly ordered. $(D r[n..r.length]) -will contain the elements not in $(D r[0..n]). These will be in an undefined +Partially shuffles the elements of `r` such that upon returning `r[0..n]` +is a random subset of `r` and is randomly ordered. `r[n..r.length]` +will contain the elements not in `r[0..n]`. These will be in an undefined order, but will not be random in the sense that their order after -$(D partialShuffle) returns will not be independent of their order before -$(D partialShuffle) was called. +`partialShuffle` returns will not be independent of their order before +`partialShuffle` was called. -$(D r) must be a random-access range with length. $(D n) must be less than -or equal to $(D r.length). If no RNG is specified, $(D rndGen) will be used. +`r` must be a random-access range with length. `n` must be less than +or equal to `r.length`. If no RNG is specified, `rndGen` will be used. Params: r = random-access range whose elements are to be shuffled - n = number of elements of $(D r) to shuffle (counting from the beginning); - must be less than $(D r.length) + n = number of elements of `r` to shuffle (counting from the beginning); + must be less than `r.length` gen = (optional) random number generator to use; if not - specified, defaults to $(D rndGen) + specified, defaults to `rndGen` */ void partialShuffle(Range, RandomGen)(Range r, in size_t n, ref RandomGen gen) if(isRandomAccessRange!Range && isUniformRNG!RandomGen) @@ -1916,11 +1916,11 @@ unittest /** Rolls a dice with relative probabilities stored in $(D -proportions). Returns the index in $(D proportions) that was chosen. +proportions). Returns the index in `proportions` that was chosen. Params: rnd = (optional) random number generator to use; if not - specified, defaults to $(D rndGen) + specified, defaults to `rndGen` proportions = forward range or list of individual values whose elements correspond to the probabilities with which to choose the corresponding index @@ -1928,9 +1928,9 @@ Params: Returns: Random variate drawn from the index values - [0, ... $(D proportions.length) - 1], with the probability - of getting an individual index value $(D i) being proportional to - $(D proportions[i]). + [0, ... `proportions.length` - 1], with the probability + of getting an individual index value `i` being proportional to + `proportions[i]`. Example: @@ -2009,22 +2009,22 @@ unittest } /** -Covers a given range $(D r) in a random manner, i.e. goes through each -element of $(D r) once and only once, just in a random order. $(D r) +Covers a given range `r` in a random manner, i.e. goes through each +element of `r` once and only once, just in a random order. `r` must be a random-access range with length. -If no random number generator is passed to $(D randomCover), the +If no random number generator is passed to `randomCover`, the thread-global RNG rndGen will be used internally. Params: r = random-access range to cover rng = (optional) random number generator to use; - if not specified, defaults to $(D rndGen) + if not specified, defaults to `rndGen` Returns: - Range whose elements consist of the elements of $(D r), - in random order. Will be a forward range if both $(D r) and - $(D rng) are forward ranges, an input range otherwise. + Range whose elements consist of the elements of `r`, + in random order. Will be a forward range if both `r` and + `rng` are forward ranges, an input range otherwise. Example: ---- @@ -2236,49 +2236,49 @@ unittest // RandomSample /** -Selects a random subsample out of $(D r), containing exactly $(D n) +Selects a random subsample out of `r`, containing exactly `n` elements. The order of elements is the same as in the original -range. The total length of $(D r) must be known. If $(D total) is +range. The total length of `r` must be known. If `total` is passed in, the total number of sample is considered to be $(D -total). Otherwise, $(D RandomSample) uses $(D r.length). +total). Otherwise, `RandomSample` uses `r.length`. Params: r = range to sample from n = number of elements to include in the sample; must be less than or equal to the total number - of elements in $(D r) and/or the parameter - $(D total) (if provided) - total = (semi-optional) number of elements of $(D r) + of elements in `r` and/or the parameter + `total` (if provided) + total = (semi-optional) number of elements of `r` from which to select the sample (counting from the beginning); must be less than or equal to - the total number of elements in $(D r) itself. - May be omitted if $(D r) has the $(D .length) + the total number of elements in `r` itself. + May be omitted if `r` has the `.length` property and the sample is to be drawn from - all elements of $(D r). + all elements of `r`. rng = (optional) random number generator to use; - if not specified, defaults to $(D rndGen) + if not specified, defaults to `rndGen` Returns: Range whose elements consist of a randomly selected subset of - the elements of $(D r), in the same order as these elements - appear in $(D r) itself. Will be a forward range if both $(D r) - and $(D rng) are forward ranges, an input range otherwise. + the elements of `r`, in the same order as these elements + appear in `r` itself. Will be a forward range if both `r` + and `rng` are forward ranges, an input range otherwise. -$(D RandomSample) implements Jeffrey Scott Vitter's Algorithm D +`RandomSample` implements Jeffrey Scott Vitter's Algorithm D (see Vitter $(WEB dx.doi.org/10.1145/358105.893, 1984), $(WEB dx.doi.org/10.1145/23002.23003, 1987)), which selects a sample -of size $(D n) in O(n) steps and requiring O(n) random variates, +of size `n` in O(n) steps and requiring O(n) random variates, regardless of the size of the data being sampled. The exception to this is if traversing k elements on the input range is itself an O(k) operation (e.g. when sampling lines from an input file), in which case the sampling calculation will inevitably be of O(total). -RandomSample will throw an exception if $(D total) is verifiably +RandomSample will throw an exception if `total` is verifiably less than the total number of elements available in the input, or if $(D n > total). -If no random number generator is passed to $(D randomSample), the +If no random number generator is passed to `randomSample`, the thread-global RNG rndGen will be used internally. Example: diff --git a/std/range/interfaces.d b/std/range/interfaces.d index 5ee24a4c008..cc221e996b1 100644 --- a/std/range/interfaces.d +++ b/std/range/interfaces.d @@ -1,11 +1,11 @@ /** This module is a submodule of $(LINK2 std_range_package.html, std.range). -The main $(D std.range) module provides template-based tools for working with +The main `std.range` module provides template-based tools for working with ranges, but sometimes an object-based interface for ranges is needed, such as when runtime polymorphism is required. For this purpose, this submodule -provides a number of object and $(D interface) definitions that can be used to -wrap around _range objects created by the $(D std.range) templates. +provides a number of object and `interface` definitions that can be used to +wrap around _range objects created by the `std.range` templates. $(BOOKTABLE , $(TR $(TD $(D $(LREF InputRange))) @@ -39,11 +39,11 @@ $(BOOKTABLE , $(TD Wrapper for output ranges. )) $(TR $(TD $(D $(LREF OutputRangeObject))) - $(TD Class that implements the $(D OutputRange) interface and wraps the - $(D put) methods in virtual functions. + $(TD Class that implements the `OutputRange` interface and wraps the + `put` methods in virtual functions. )) $(TR $(TD $(D $(LREF InputRangeObject))) - $(TD Class that implements the $(D InputRange) interface and wraps the + $(TD Class that implements the `InputRange` interface and wraps the input _range methods in virtual functions. )) $(TR $(TD $(D $(LREF RefRange))) @@ -77,7 +77,7 @@ import std.typetuple; * binary interface is required, such as when a DLL function or virtual function * needs to accept a generic range as a parameter. Note that * $(LREF isInputRange) and friends check for conformance to structural - * interfaces, not for implementation of these $(D interface) types. + * interfaces, not for implementation of these `interface` types. * * Examples: * --- @@ -97,7 +97,7 @@ import std.typetuple; * * Limitations: * - * These interfaces are not capable of forwarding $(D ref) access to elements. + * These interfaces are not capable of forwarding `ref` access to elements. * * Infiniteness of the wrapped range is not propagated. * @@ -128,7 +128,7 @@ interface InputRange(E) { * InputRangeObject, range primitives: 877 milliseconds (3.15x penalty) */ - /**$(D foreach) iteration uses opApply, since one delegate call per loop + /**`foreach` iteration uses opApply, since one delegate call per loop * iteration is faster than three virtual function calls. */ int opApply(int delegate(E)); @@ -138,13 +138,13 @@ interface InputRange(E) { } -/**Interface for a forward range of type $(D E).*/ +/**Interface for a forward range of type `E`.*/ interface ForwardRange(E) : InputRange!E { /// @property ForwardRange!E save(); } -/**Interface for a bidirectional range of type $(D E).*/ +/**Interface for a bidirectional range of type `E`.*/ interface BidirectionalRange(E) : ForwardRange!(E) { /// @property BidirectionalRange!E save(); @@ -159,7 +159,7 @@ interface BidirectionalRange(E) : ForwardRange!(E) { void popBack(); } -/**Interface for a finite random access range of type $(D E).*/ +/**Interface for a finite random access range of type `E`.*/ interface RandomAccessFinite(E) : BidirectionalRange!(E) { /// @property RandomAccessFinite!E save(); @@ -184,7 +184,7 @@ interface RandomAccessFinite(E) : BidirectionalRange!(E) { } } -/**Interface for an infinite random access range of type $(D E).*/ +/**Interface for an infinite random access range of type `E`.*/ interface RandomAccessInfinite(E) : ForwardRange!E { /// E moveAt(size_t); @@ -226,8 +226,8 @@ interface RandomFiniteAssignable(E) : RandomAccessFinite!E, BidirectionalAssigna void opIndexAssign(E val, size_t index); } -/**Interface for an output range of type $(D E). Usage is similar to the - * $(D InputRange) interface and descendants.*/ +/**Interface for an output range of type `E`. Usage is similar to the + * `InputRange` interface and descendants.*/ interface OutputRange(E) { /// void put(E); @@ -256,8 +256,8 @@ private string putMethods(E...)() return ret; } -/**Implements the $(D OutputRange) interface for all types E and wraps the - * $(D put) method for each type $(D E) in a virtual function. +/**Implements the `OutputRange` interface for all types E and wraps the + * `put` method for each type `E` in a virtual function. */ class OutputRangeObject(R, E...) : staticMap!(OutputRange, E) { // @BUG 4689: There should be constraints on this template class, but @@ -272,7 +272,7 @@ class OutputRangeObject(R, E...) : staticMap!(OutputRange, E) { } -/**Returns the interface type that best matches $(D R).*/ +/**Returns the interface type that best matches `R`.*/ template MostDerivedInputRange(R) if (isInputRange!(Unqual!R)) { private alias E = ElementType!R; @@ -305,9 +305,9 @@ template MostDerivedInputRange(R) if (isInputRange!(Unqual!R)) { } } -/**Implements the most derived interface that $(D R) works with and wraps - * all relevant range primitives in virtual functions. If $(D R) is already - * derived from the $(D InputRange) interface, aliases itself away. +/**Implements the most derived interface that `R` works with and wraps + * all relevant range primitives in virtual functions. If `R` is already + * derived from the `InputRange` interface, aliases itself away. */ template InputRangeObject(R) if (isInputRange!(Unqual!R)) { static if (is(R : InputRange!(ElementType!R))) { @@ -424,7 +424,7 @@ template InputRangeObject(R) if (isInputRange!(Unqual!R)) { } } -/**Convenience function for creating an $(D InputRangeObject) of the proper type. +/**Convenience function for creating an `InputRangeObject` of the proper type. * See $(LREF InputRange) for an example. */ InputRangeObject!R inputRangeObject(R)(R range) if (isInputRange!R) { @@ -435,8 +435,8 @@ InputRangeObject!R inputRangeObject(R)(R range) if (isInputRange!R) { } } -/**Convenience function for creating an $(D OutputRangeObject) with a base range - * of type $(D R) that accepts types $(D E). +/**Convenience function for creating an `OutputRangeObject` with a base range + * of type `R` that accepts types `E`. Examples: --- diff --git a/std/range/package.d b/std/range/package.d index 2a39488a2ee..2d394452d15 100644 --- a/std/range/package.d +++ b/std/range/package.d @@ -55,8 +55,8 @@ $(BOOKTABLE , elements of the given _range. )) $(TR $(TD $(D $(LREF takeExactly))) - $(TD Like $(D take), but assumes the given _range actually has $(I n) - elements, and therefore also defines the $(D length) property. + $(TD Like `take`, but assumes the given _range actually has $(I n) + elements, and therefore also defines the `length` property. )) $(TR $(TD $(D $(LREF takeOne))) $(TD Creates a random-access _range consisting of exactly the first @@ -92,16 +92,16 @@ $(BOOKTABLE , etc. )) $(TR $(TD $(D $(LREF lockstep))) - $(TD Iterates $(I n) _ranges in lockstep, for use in a $(D foreach) - loop. Similar to $(D zip), except that $(D lockstep) is designed - especially for $(D foreach) loops. + $(TD Iterates $(I n) _ranges in lockstep, for use in a `foreach` + loop. Similar to `zip`, except that `lockstep` is designed + especially for `foreach` loops. )) $(TR $(TD $(D $(LREF recurrence))) $(TD Creates a forward _range whose values are defined by a mathematical recurrence relation. )) $(TR $(TD $(D $(LREF sequence))) - $(TD Similar to $(D recurrence), except that a random-access _range is + $(TD Similar to `recurrence`, except that a random-access _range is created. )) $(TR $(TD $(D $(LREF iota))) @@ -145,8 +145,8 @@ $(BOOKTABLE , Ranges whose elements are sorted afford better efficiency with certain operations. For this, the $(D $(LREF assumeSorted)) function can be used to construct a $(D $(LREF SortedRange)) from a pre-sorted _range. The $(LINK2 -std_algorithm.html#sort, $(D std.algorithm.sort)) function also conveniently -returns a $(D SortedRange). $(D SortedRange) objects provide some additional +std_algorithm.html#sort, `std.algorithm.sort`) function also conveniently +returns a `SortedRange`. `SortedRange` objects provide some additional _range operations that take advantage of the fact that the _range is sorted. Source: $(PHOBOSSRC std/_range/_package.d) @@ -176,7 +176,7 @@ import std.typetuple; /** Iterates a bidirectional range backwards. The original range can be -accessed by using the $(D source) property. Applying retro twice to +accessed by using the `source` property. Applying retro twice to the same range yields the original range. */ auto retro(Range)(Range r) @@ -400,13 +400,13 @@ if (isBidirectionalRange!(Unqual!Range)) /** -Iterates range $(D r) with stride $(D n). If the range is a +Iterates range `r` with stride `n`. If the range is a random-access range, moves by indexing into the range; otherwise, -moves by successive calls to $(D popFront). Applying stride twice to +moves by successive calls to `popFront`. Applying stride twice to the same range results in a stride with a step that is the product of the two applications. -Throws: $(D Exception) if $(D n == 0). +Throws: `Exception` if $(D n == 0). Example: ---- @@ -760,14 +760,14 @@ if (isInputRange!(Unqual!Range)) } /** -Spans multiple ranges in sequence. The function $(D chain) takes any +Spans multiple ranges in sequence. The function `chain` takes any number of ranges and returns a $(D Chain!(R1, R2,...)) object. The ranges may be different, but they must have the same element type. The -result is a range that offers the $(D front), $(D popFront), and $(D +result is a range that offers the `front`, `popFront`, and $(D empty) primitives. If all input ranges offer random access and $(D -length), $(D Chain) offers them as well. +length), `Chain` offers them as well. -If only one range is offered to $(D Chain) or $(D chain), the $(D +If only one range is offered to `Chain` or `chain`, the $(D Chain) type exits the picture by aliasing itself directly to that range's type. @@ -1204,10 +1204,10 @@ if (Ranges.length > 0 && } /** -$(D roundRobin(r1, r2, r3)) yields $(D r1.front), then $(D r2.front), -then $(D r3.front), after which it pops off one element from each and -continues again from $(D r1). For example, if two ranges are involved, -it alternately yields elements off the two ranges. $(D roundRobin) +$(D roundRobin(r1, r2, r3)) yields `r1.front`, then `r2.front`, +then `r3.front`, after which it pops off one element from each and +continues again from `r1`. For example, if two ranges are involved, +it alternately yields elements off the two ranges. `roundRobin` stops after it has consumed all ranges (skipping over the ones that finish early). */ @@ -1398,9 +1398,9 @@ if (isRandomAccessRange!(Unqual!R) && hasLength!(Unqual!R)) } /** -Lazily takes only up to $(D n) elements of a range. This is +Lazily takes only up to `n` elements of a range. This is particularly useful when using with infinite ranges. If the range -offers random access and $(D length), $(D Take) offers them as well. +offers random access and `length`, `Take` offers them as well. */ struct Take(Range) if (isInputRange!(Unqual!Range) && @@ -1723,13 +1723,13 @@ if (isInputRange!(Unqual!R) && (isInfinite!(Unqual!R) || !hasSlicing!(Unqual!R) /** -Similar to $(LREF take), but assumes that $(D range) has at least $(D +Similar to $(LREF take), but assumes that `range` has at least $(D n) elements. Consequently, the result of $(D takeExactly(range, n)) -always defines the $(D length) property (and initializes it to $(D n)) -even when $(D range) itself does not define $(D length). +always defines the `length` property (and initializes it to `n`) +even when `range` itself does not define `length`. -The result of $(D takeExactly) is identical to that of $(LREF take) in -cases where the original range defines $(D length) or is infinite. +The result of `takeExactly` is identical to that of $(LREF take) in +cases where the original range defines `length` or is infinite. */ auto takeExactly(R)(R range, size_t n) if (isInputRange!R) @@ -1919,15 +1919,15 @@ if (isInputRange!R) /** Returns a range with at most one element; for example, $(D takeOne([42, 43, 44])) returns a range consisting of the integer $(D -42). Calling $(D popFront()) off that range renders it empty. +42). Calling `popFront()` off that range renders it empty. -In effect $(D takeOne(r)) is somewhat equivalent to $(D take(r, 1)) but in +In effect `takeOne(r)` is somewhat equivalent to $(D take(r, 1)) but in certain interfaces it is important to know statically that the range may only have at most one element. -The type returned by $(D takeOne) is a random-access range with length -regardless of $(D R)'s capabilities (another feature that distinguishes -$(D takeOne) from $(D take)). +The type returned by `takeOne` is a random-access range with length +regardless of `R`'s capabilities (another feature that distinguishes +`takeOne` from `take`). */ auto takeOne(R)(R source) if (isInputRange!R) { @@ -2000,7 +2000,7 @@ unittest /++ Returns an empty range which is statically known to be empty and is - guaranteed to have $(D length) and be random access regardless of $(D R)'s + guaranteed to have `length` and be random access regardless of `R`'s capabilities. +/ auto takeNone(R)() @@ -2184,16 +2184,16 @@ auto takeNone(R)(R range) /++ Convenience function which calls - $(D range.$(LREF popFrontN)(n)) and returns $(D range). $(D drop) + $(D range.$(LREF popFrontN)(n)) and returns `range`. `drop` makes it easier to pop elements from a range and then pass it to another function within a single expression, - whereas $(D popFrontN) would require multiple statements. + whereas `popFrontN` would require multiple statements. - $(D dropBack) provides the same functionality but instead calls - $(D range.popBackN(n)). + `dropBack` provides the same functionality but instead calls + `range.popBackN(n)`. - Note: $(D drop) and $(D dropBack) will only pop $(I up to) - $(D n) elements but will stop if the range is empty first. + Note: `drop` and `dropBack` will only pop $(I up to) + `n` elements but will stop if the range is empty first. +/ R drop(R)(R range, size_t n) @@ -2262,17 +2262,17 @@ R dropBack(R)(R range, size_t n) } /++ - Similar to $(LREF drop) and $(D dropBack) but they call - $(D range.$(LREF popFrontExactly)(n)) and $(D range.popBackExactly(n)) + Similar to $(LREF drop) and `dropBack` but they call + $(D range.$(LREF popFrontExactly)(n)) and `range.popBackExactly(n)` instead. - Note: Unlike $(D drop), $(D dropExactly) will assume that the - range holds at least $(D n) elements. This makes $(D dropExactly) - faster than $(D drop), but it also means that if $(D range) does - not contain at least $(D n) elements, it will attempt to call $(D popFront) + Note: Unlike `drop`, `dropExactly` will assume that the + range holds at least `n` elements. This makes `dropExactly` + faster than `drop`, but it also means that if `range` does + not contain at least `n` elements, it will attempt to call `popFront` on an empty range, which is undefined behavior. So, only use - $(D popFrontExactly) when it is guaranteed that $(D range) holds at least - $(D n) elements. + `popFrontExactly` when it is guaranteed that `range` holds at least + `n` elements. +/ R dropExactly(R)(R range, size_t n) if(isInputRange!R) @@ -2308,13 +2308,13 @@ R dropBackExactly(R)(R range, size_t n) /++ Convenience function which calls - $(D range.popFront()) and returns $(D range). $(D dropOne) + `range.popFront()` and returns `range`. `dropOne` makes it easier to pop an element from a range and then pass it to another function within a single expression, - whereas $(D popFront) would require multiple statements. + whereas `popFront` would require multiple statements. - $(D dropBackOne) provides the same functionality but instead calls - $(D range.popBack()). + `dropBackOne` provides the same functionality but instead calls + `range.popBack()`. +/ R dropOne(R)(R range) if (isInputRange!R) @@ -2427,7 +2427,7 @@ Repeat!T repeat(T)(T value) { return Repeat!T(value); } } /** - Repeats $(D value) exactly $(D n) times. Equivalent to $(D + Repeats `value` exactly `n` times. Equivalent to $(D take(repeat(value), n)). */ Take!(Repeat!T) repeat(T)(T value, size_t n) @@ -2460,11 +2460,11 @@ Take!(Repeat!T) repeat(T)(T value, size_t n) /** Repeats the given forward range ad infinitum. If the original range is -infinite (fact that would make $(D Cycle) the identity application), -$(D Cycle) detects that and aliases itself to the range type -itself. If the original range has random access, $(D Cycle) offers +infinite (fact that would make `Cycle` the identity application), +`Cycle` detects that and aliases itself to the range type +itself. If the original range has random access, `Cycle` offers random access and also offers a constructor taking an initial position -$(D index). $(D Cycle) works with static arrays in addition to ranges, +`index`. `Cycle` works with static arrays in addition to ranges, mostly for performance reasons. Tip: This is a great way to implement simple circular buffers. @@ -2888,8 +2888,8 @@ private alias lengthType(R) = typeof(R.init.length.init); /** Iterate several ranges in lockstep. The element type is a proxy tuple - that allows accessing the current element in the $(D n)th range by - using $(D e[n]). + that allows accessing the current element in the `n`th range by + using `e[n]`. Example: ---- @@ -2902,7 +2902,7 @@ private alias lengthType(R) = typeof(R.init.length.init); } ---- - $(D Zip) offers the lowest range facilities of all components, e.g. it + `Zip` offers the lowest range facilities of all components, e.g. it offers random access iff all ranges offer random access, and also offers mutation and swapping if all ranges offer it. Due to this, $(D Zip) is extremely powerful because it allows manipulating several @@ -2931,7 +2931,7 @@ struct Zip(Ranges...) } /** - Returns $(D true) if the range is at end. The test depends on the + Returns `true` if the range is at end. The test depends on the stopping policy. */ static if (allSatisfy!(isInfinite, R)) @@ -3115,7 +3115,7 @@ struct Zip(Ranges...) } /** - Calls $(D popBack) for all controlled ranges. + Calls `popBack` for all controlled ranges. */ static if (allSatisfy!(isBidirectionalRange, R)) { @@ -3152,7 +3152,7 @@ struct Zip(Ranges...) /** Returns the length of this range. Defined only if all ranges define - $(D length). + `length`. */ static if (allSatisfy!(hasLength, R)) { @@ -3195,7 +3195,7 @@ struct Zip(Ranges...) } /** - Returns the $(D n)th element in the composite range. Defined if all + Returns the `n`th element in the composite range. Defined if all ranges offer random access. */ static if (allSatisfy!(isRandomAccessRange, R)) @@ -3210,7 +3210,7 @@ struct Zip(Ranges...) } /** - Assigns to the $(D n)th element in the composite range. Defined if + Assigns to the `n`th element in the composite range. Defined if all ranges offer random access. */ static if (allSatisfy!(hasAssignableElements, R)) @@ -3226,7 +3226,7 @@ struct Zip(Ranges...) } /** - Destructively reads the $(D n)th element in the composite + Destructively reads the `n`th element in the composite range. Defined if all ranges offer random access. */ static if (allSatisfy!(hasMobileElements, R)) @@ -3269,7 +3269,7 @@ auto zip(Ranges...)(StoppingPolicy sp, Ranges ranges) } /** - Dictates how iteration in a $(D Zip) should stop. By default stop at + Dictates how iteration in a `Zip` should stop. By default stop at the end of the shortest of all ranges. */ enum StoppingPolicy @@ -3512,18 +3512,18 @@ private string lockstepMixin(Ranges...)(bool withIndex) } /** - Iterate multiple ranges in lockstep using a $(D foreach) loop. If only a single - range is passed in, the $(D Lockstep) aliases itself away. If the - ranges are of different lengths and $(D s) == $(D StoppingPolicy.shortest) + Iterate multiple ranges in lockstep using a `foreach` loop. If only a single + range is passed in, the `Lockstep` aliases itself away. If the + ranges are of different lengths and `s` == `StoppingPolicy.shortest` stop after the shortest range is empty. If the ranges are of different - lengths and $(D s) == $(D StoppingPolicy.requireSameLength), throw an - exception. $(D s) may not be $(D StoppingPolicy.longest), and passing this + lengths and `s` == `StoppingPolicy.requireSameLength`, throw an + exception. `s` may not be `StoppingPolicy.longest`, and passing this will throw an exception. - By default $(D StoppingPolicy) is set to $(D StoppingPolicy.shortest). + By default `StoppingPolicy` is set to `StoppingPolicy.shortest`. - BUGS: If a range does not offer lvalue access, but $(D ref) is used in the - $(D foreach) loop, it will be silently accepted but any modifications + BUGS: If a range does not offer lvalue access, but `ref` is used in the + `foreach` loop, it will be silently accepted but any modifications to the variable will not be propagated to the underlying range. // Lockstep also supports iterating with an index variable: @@ -3683,11 +3683,11 @@ unittest Creates a mathematical sequence given the initial values and a recurrence function that computes the next value from the existing values. The sequence comes in the form of an infinite forward -range. The type $(D Recurrence) itself is seldom used directly; most +range. The type `Recurrence` itself is seldom used directly; most often, recurrences are obtained by calling the function $(D recurrence). -When calling $(D recurrence), the function that computes the next +When calling `recurrence`, the function that computes the next value is specified as a template argument, and the initial values in the recurrence are passed as regular arguments. For example, in a Fibonacci sequence, there are two initial values (and therefore a @@ -3698,17 +3698,17 @@ The signature of this function should be: ---- auto fun(R)(R state, size_t n) ---- -where $(D n) will be the index of the current value, and $(D state) will be an +where `n` will be the index of the current value, and `state` will be an opaque state vector that can be indexed with array-indexing notation -$(D state[i]), where valid values of $(D i) range from $(D (n - 1)) to +`state[i]`, where valid values of `i` range from $(D (n - 1)) to $(D (n - State.length)). -If the function is passed in string form, the state has name $(D "a") -and the zero-based index in the recurrence has name $(D "n"). The -given string must return the desired value for $(D a[n]) given $(D a[n +If the function is passed in string form, the state has name `"a"` +and the zero-based index in the recurrence has name `"n"`. The +given string must return the desired value for `a[n]` given $(D a[n - 1]), $(D a[n - 2]), $(D a[n - 3]),..., $(D a[n - stateSize]). The state size is dictated by the number of arguments passed to the call -to $(D recurrence). The $(D Recurrence) struct itself takes care of +to `recurrence`. The `Recurrence` struct itself takes care of managing the recurrence's state and shifting it appropriately. */ struct Recurrence(alias fun, StateType, size_t stateSize) @@ -3806,15 +3806,15 @@ recurrence(alias fun, State...)(State initial) } /** - $(D Sequence) is similar to $(D Recurrence) except that iteration is + `Sequence` is similar to `Recurrence` except that iteration is presented in the so-called $(WEB en.wikipedia.org/wiki/Closed_form, - closed form). This means that the $(D n)th element in the series is - computable directly from the initial values and $(D n) itself. This - implies that the interface offered by $(D Sequence) is a random-access - range, as opposed to the regular $(D Recurrence), which only offers + closed form). This means that the `n`th element in the series is + computable directly from the initial values and `n` itself. This + implies that the interface offered by `Sequence` is a random-access + range, as opposed to the regular `Recurrence`, which only offers forward iteration. - The state of the sequence is stored as a $(D Tuple) so it can be + The state of the sequence is stored as a `Tuple` so it can be heterogeneous. */ struct Sequence(alias fun, State) @@ -3990,19 +3990,19 @@ unittest step = The value to add to the current value at each iteration. Returns: - A range that goes through the numbers $(D begin), $(D begin + step), - $(D begin + 2 * step), $(D ...), up to and excluding $(D end). + A range that goes through the numbers `begin`, $(D begin + step), + $(D begin + 2 * step), `...`, up to and excluding `end`. The two-argument overloads have $(D step = 1). If $(D begin < end && step < 0) or $(D begin > end && step > 0) or $(D begin == end), then an empty range is returned. For built-in types, the range returned is a random access range. For - user-defined types that support $(D ++), the range is an input + user-defined types that support `++`, the range is an input range. Throws: - $(D Exception) if $(D begin != end && step == 0), an exception is + `Exception` if $(D begin != end && step == 0), an exception is thrown. */ auto iota(B, E, S)(B begin, E end, S step) @@ -4489,7 +4489,7 @@ auto iota(B, E)(B begin, E end) /** User-defined types such as $(XREF bigint, BigInt) are also supported, as long -as they can be incremented with $(D ++) and compared with $(D <) or $(D ==). +as they can be incremented with `++` and compared with `<` or `==`. */ // Issue 6447 unittest @@ -4662,7 +4662,7 @@ struct FrontTransversal(Ror, } /** - Duplicates this $(D frontTransversal). Note that only the encapsulating + Duplicates this `frontTransversal`. Note that only the encapsulating range of range will be duplicated. Underlying ranges will not be duplicated. */ @@ -4744,7 +4744,7 @@ struct FrontTransversal(Ror, } /** - Slicing if offered if $(D RangeOfRanges) supports slicing and all the + Slicing if offered if `RangeOfRanges` supports slicing and all the conditions for supporting indexing are met. */ static if (hasSlicing!RangeOfRanges) @@ -5040,7 +5040,7 @@ struct Transversal(Ror, } /** - Slicing if offered if $(D RangeOfRanges) supports slicing and all the + Slicing if offered if `RangeOfRanges` supports slicing and all the conditions for supporting indexing are met. */ static if (hasSlicing!RangeOfRanges) @@ -5278,13 +5278,13 @@ Transposed!RangeOfRanges transposed(RangeOfRanges)(RangeOfRanges rr) } /** -This struct takes two ranges, $(D source) and $(D indices), and creates a view -of $(D source) as if its elements were reordered according to $(D indices). -$(D indices) may include only a subset of the elements of $(D source) and +This struct takes two ranges, `source` and `indices`, and creates a view +of `source` as if its elements were reordered according to `indices`. +`indices` may include only a subset of the elements of `source` and may also repeat elements. -$(D Source) must be a random access range. The returned range will be -bidirectional or random-access if $(D Indices) is bidirectional or +`Source` must be a random access range. The returned range will be +bidirectional or random-access if `Indices` is bidirectional or random-access, respectively. */ struct Indexed(Source, Indices) @@ -5463,7 +5463,7 @@ struct Indexed(Source, Indices) /** Returns the physical index into the source range corresponding to a given logical index. This is useful, for example, when indexing - an $(D Indexed) without adding another layer of indirection. + an `Indexed` without adding another layer of indirection. Examples: --- @@ -5532,12 +5532,12 @@ Indexed!(Source, Indices) indexed(Source, Indices)(Source source, Indices indice } /** -This range iterates over fixed-sized chunks of size $(D chunkSize) of a -$(D source) range. $(D Source) must be a forward range. +This range iterates over fixed-sized chunks of size `chunkSize` of a +`source` range. `Source` must be a forward range. -If $(D !isInfinite!Source) and $(D source.walkLength) is not evenly -divisible by $(D chunkSize), the back element of this range will contain -fewer than $(D chunkSize) elements. +If `!isInfinite!Source` and `source.walkLength` is not evenly +divisible by `chunkSize`, the back element of this range will contain +fewer than `chunkSize` elements. */ struct Chunks(Source) if (isForwardRange!Source) @@ -5582,7 +5582,7 @@ struct Chunks(Source) static if (hasLength!Source) { - /// Length. Only if $(D hasLength!Source) is $(D true) + /// Length. Only if `hasLength!Source` is `true` @property size_t length() { // Note: _source.length + _chunkSize may actually overflow. @@ -5603,7 +5603,7 @@ struct Chunks(Source) /** Indexing and slicing operations. Provided only if - $(D hasSlicing!Source) is $(D true). + `hasSlicing!Source` is `true`. */ auto opIndex(size_t index) { @@ -5713,7 +5713,7 @@ struct Chunks(Source) { /** Bidirectional range primitives. Provided only if both - $(D hasSlicing!Source) and $(D hasLength!Source) are $(D true). + `hasSlicing!Source` and `hasLength!Source` are `true`. */ @property auto back() { @@ -6020,7 +6020,7 @@ private struct OnlyResult(T, size_t arity : 0) } /** -Assemble $(D values) into a range that carries all its +Assemble `values` into a range that carries all its elements in-situ. Useful when a single value or multiple disconnected values @@ -6225,27 +6225,27 @@ unittest } /** -Iterate over $(D range) with an attached index variable. +Iterate over `range` with an attached index variable. Each element is a $(XREF typecons, Tuple) containing the index -and the element, in that order, where the index member is named $(D index) -and the element member is named $(D value). +and the element, in that order, where the index member is named `index` +and the element member is named `value`. -The index starts at $(D start) and is incremented by one on every iteration. +The index starts at `start` and is incremented by one on every iteration. -Bidirectionality is propagated only if $(D range) has length. +Bidirectionality is propagated only if `range` has length. Overflow: -If $(D range) has length, then it is an error to pass a value for $(D start) -so that $(D start + range.length) is bigger than $(D Enumerator.max), thus it is +If `range` has length, then it is an error to pass a value for `start` +so that $(D start + range.length) is bigger than `Enumerator.max`, thus it is ensured that overflow cannot happen. -If $(D range) does not have length, and $(D popFront) is called when +If `range` does not have length, and `popFront` is called when $(D front.index == Enumerator.max), the index will overflow and -continue from $(D Enumerator.min). +continue from `Enumerator.min`. Examples: -Useful for using $(D foreach) with an index loop variable: +Useful for using `foreach` with an index loop variable: ---- import std.stdio : stdin, stdout; import std.range : enumerate; @@ -6583,7 +6583,7 @@ version(none) // @@@BUG@@@ 10939 } /** - Returns true if $(D fn) accepts variables of type T1 and T2 in any order. + Returns true if `fn` accepts variables of type T1 and T2 in any order. The following code should compile: --- T1 foo(); @@ -6607,8 +6607,8 @@ template isTwoWayCompatible(alias fn, T1, T2) /** - Policy used with the searching primitives $(D lowerBound), $(D - upperBound), and $(D equalRange) of $(LREF SortedRange) below. + Policy used with the searching primitives `lowerBound`, $(D + upperBound), and `equalRange` of $(LREF SortedRange) below. */ enum SearchPolicy { @@ -6642,21 +6642,21 @@ enum SearchPolicy Searches using a classic interval halving policy. The search starts in the middle of the range, and each search step cuts the range in half. This policy finds a value in $(BIGOH log(n)) - time but is less cache friendly than $(D gallop) for large - ranges. The $(D binarySearch) policy is used as the last step - of $(D trot), $(D gallop), $(D trotBackwards), and $(D + time but is less cache friendly than `gallop` for large + ranges. The `binarySearch` policy is used as the last step + of `trot`, `gallop`, `trotBackwards`, and $(D gallopBackwards) strategies. */ binarySearch, /** - Similar to $(D trot) but starts backwards. Use it when + Similar to `trot` but starts backwards. Use it when confident that the value is around the end of the range. */ trotBackwards, /** - Similar to $(D gallop) but starts backwards. Use it when + Similar to `gallop` but starts backwards. Use it when confident that the value is around the end of the range. */ gallopBackwards @@ -6666,9 +6666,9 @@ enum SearchPolicy Represents a sorted range. In addition to the regular range primitives, supports additional operations that take advantage of the ordering, such as merge and binary search. To obtain a $(D -SortedRange) from an unsorted range $(D r), use $(XREF algorithm, -sort) which sorts $(D r) in place and returns the corresponding $(D -SortedRange). To construct a $(D SortedRange) from a range $(D r) that +SortedRange) from an unsorted range `r`, use $(XREF algorithm, +sort) which sorts `r` in place and returns the corresponding $(D +SortedRange). To construct a `SortedRange` from a range `r` that is known to be already sorted, use $(LREF assumeSorted) described below. */ @@ -6903,10 +6903,10 @@ if (isInputRange!Range) // lowerBound /** - This function uses a search with policy $(D sp) to find the - largest left subrange on which $(D pred(x, value)) is $(D true) for - all $(D x) (e.g., if $(D pred) is "less than", returns the portion of - the range with elements strictly smaller than $(D value)). The search + This function uses a search with policy `sp` to find the + largest left subrange on which $(D pred(x, value)) is `true` for + all `x` (e.g., if `pred` is "less than", returns the portion of + the range with elements strictly smaller than `value`). The search schedule and its complexity are documented in $(LREF SearchPolicy). See also STL's $(WEB sgi.com/tech/stl/lower_bound.html, lower_bound). @@ -6927,16 +6927,16 @@ if (isInputRange!Range) // upperBound /** -This function searches with policy $(D sp) to find the largest right -subrange on which $(D pred(value, x)) is $(D true) for all $(D x) -(e.g., if $(D pred) is "less than", returns the portion of the range -with elements strictly greater than $(D value)). The search schedule +This function searches with policy `sp` to find the largest right +subrange on which $(D pred(value, x)) is `true` for all `x` +(e.g., if `pred` is "less than", returns the portion of the range +with elements strictly greater than `value`). The search schedule and its complexity are documented in $(LREF SearchPolicy). -For ranges that do not offer random access, $(D SearchPolicy.linear) +For ranges that do not offer random access, `SearchPolicy.linear` is the only policy allowed (and it must be specified explicitly lest it exposes user code to unexpected inefficiencies). For random-access searches, all -policies are allowed, and $(D SearchPolicy.binarySearch) is the default. +policies are allowed, and `SearchPolicy.binarySearch` is the default. See_Also: STL's $(WEB sgi.com/tech/stl/lower_bound.html,upper_bound). @@ -6969,13 +6969,13 @@ assert(equal(p, [4, 4, 5, 6])); // equalRange /** - Returns the subrange containing all elements $(D e) for which both $(D - pred(e, value)) and $(D pred(value, e)) evaluate to $(D false) (e.g., - if $(D pred) is "less than", returns the portion of the range with - elements equal to $(D value)). Uses a classic binary search with + Returns the subrange containing all elements `e` for which both $(D + pred(e, value)) and $(D pred(value, e)) evaluate to `false` (e.g., + if `pred` is "less than", returns the portion of the range with + elements equal to `value`). Uses a classic binary search with interval halving until it finds a value that satisfies the condition, - then uses $(D SearchPolicy.gallopBackwards) to find the left boundary - and $(D SearchPolicy.gallop) to find the right boundary. These + then uses `SearchPolicy.gallopBackwards` to find the left boundary + and `SearchPolicy.gallop` to find the right boundary. These policies are justified by the fact that the two boundaries are likely to be near the first found value (i.e., equal ranges are relatively small). Completes the entire search in $(BIGOH log(n)) time. See also @@ -7029,9 +7029,9 @@ assert(equal(p, [4, 4, 5, 6])); // trisect /** -Returns a tuple $(D r) such that $(D r[0]) is the same as the result -of $(D lowerBound(value)), $(D r[1]) is the same as the result of $(D -equalRange(value)), and $(D r[2]) is the same as the result of $(D +Returns a tuple `r` such that `r[0]` is the same as the result +of `lowerBound(value)`, `r[1]` is the same as the result of $(D +equalRange(value)), and `r[2]` is the same as the result of $(D upperBound(value)). The call is faster than computing all three separately. Uses a search schedule similar to $(D equalRange). Completes the entire search in $(BIGOH log(n)) time. @@ -7089,9 +7089,9 @@ assert(equal(r[2], [ 4, 4, 5, 6 ])); // contains /** -Returns $(D true) if and only if $(D value) can be found in $(D +Returns `true` if and only if `value` can be found in $(D range), which is assumed to be sorted. Performs $(BIGOH log(r.length)) -evaluations of $(D pred). See also STL's $(WEB +evaluations of `pred`. See also STL's $(WEB sgi.com/tech/stl/binary_search.html, binary_search). */ @@ -7138,13 +7138,13 @@ unittest } /** -$(D SortedRange) could accept ranges weaker than random-access, but it +`SortedRange` could accept ranges weaker than random-access, but it is unable to provide interesting functionality for them. Therefore, -$(D SortedRange) is currently restricted to random-access ranges. +`SortedRange` is currently restricted to random-access ranges. No copy of the original range is ever made. If the underlying range is -changed concurrently with its corresponding $(D SortedRange) in ways -that break its sortedness, $(D SortedRange) will work erratically. +changed concurrently with its corresponding `SortedRange` in ways +that break its sortedness, `SortedRange` will work erratically. */ @safe unittest { @@ -7269,11 +7269,11 @@ unittest } /** -Assumes $(D r) is sorted by predicate $(D pred) and returns the -corresponding $(D SortedRange!(pred, R)) having $(D r) as support. To +Assumes `r` is sorted by predicate `pred` and returns the +corresponding $(D SortedRange!(pred, R)) having `r` as support. To keep the checking costs low, the cost is $(BIGOH 1) in release mode (no checks for sortedness are performed). In debug mode, a few random -elements of $(D r) are checked for sortedness. The size of the sample +elements of `r` are checked for sortedness. The size of the sample is proportional $(BIGOH log(r.length)). That way, checking has no effect on the complexity of subsequent operations specific to sorted ranges (such as binary search). The probability of an arbitrary @@ -7376,8 +7376,8 @@ unittest if it were passed to it, the original range is $(I not) copied but is consumed as if it were a reference type. - Note that $(D save) works as normal and operates on a new range, so if - $(D save) is ever called on the RefRange, then no operations on the saved + Note that `save` works as normal and operates on a new range, so if + `save` is ever called on the RefRange, then no operations on the saved range will affect the original. Examples: @@ -7419,13 +7419,13 @@ public: /++ - This does not assign the pointer of $(D rhs) to this $(D RefRange). - Rather it assigns the range pointed to by $(D rhs) to the range pointed - to by this $(D RefRange). This is because $(I any) operation on a - $(D RefRange) is the same is if it occurred to the original range. The - one exception is when a $(D RefRange) is assigned $(D null) either - directly or because $(D rhs) is $(D null). In that case, $(D RefRange) - no longer refers to the original range but is $(D null). + This does not assign the pointer of `rhs` to this `RefRange`. + Rather it assigns the range pointed to by `rhs` to the range pointed + to by this `RefRange`. This is because $(I any) operation on a + `RefRange` is the same is if it occurred to the original range. The + one exception is when a `RefRange` is assigned `null` either + directly or because `rhs` is `null`. In that case, `RefRange` + no longer refers to the original range but is `null`. Examples: -------------------- @@ -7619,7 +7619,7 @@ assert(buffer2 == [11, 12, 13, 14, 15]); version(StdDdoc) { /++ - Only defined if $(D isBidirectionalRange!R) is $(D true). + Only defined if `isBidirectionalRange!R` is `true`. +/ @property auto back() {assert(0);} /++ Ditto +/ @@ -7656,7 +7656,7 @@ assert(buffer2 == [11, 12, 13, 14, 15]); version(StdDdoc) { /++ - Only defined if $(D isRandomAccesRange!R) is $(D true). + Only defined if `isRandomAccesRange!R` is `true`. +/ auto ref opIndex(IndexType)(IndexType index) {assert(0);} @@ -7680,8 +7680,8 @@ assert(buffer2 == [11, 12, 13, 14, 15]); /++ - Only defined if $(D hasMobileElements!R) and $(D isForwardRange!R) are - $(D true). + Only defined if `hasMobileElements!R` and `isForwardRange!R` are + `true`. +/ static if(hasMobileElements!R && isForwardRange!R) auto moveFront() { @@ -7690,8 +7690,8 @@ assert(buffer2 == [11, 12, 13, 14, 15]); /++ - Only defined if $(D hasMobileElements!R) and $(D isBidirectionalRange!R) - are $(D true). + Only defined if `hasMobileElements!R` and `isBidirectionalRange!R` + are `true`. +/ static if(hasMobileElements!R && isBidirectionalRange!R) auto moveBack() { @@ -7700,8 +7700,8 @@ assert(buffer2 == [11, 12, 13, 14, 15]); /++ - Only defined if $(D hasMobileElements!R) and $(D isRandomAccessRange!R) - are $(D true). + Only defined if `hasMobileElements!R` and `isRandomAccessRange!R` + are `true`. +/ static if(hasMobileElements!R && isRandomAccessRange!R) auto moveAt(IndexType)(IndexType index) if(is(typeof((*_range).moveAt(index)))) @@ -7713,7 +7713,7 @@ assert(buffer2 == [11, 12, 13, 14, 15]); version(StdDdoc) { /++ - Only defined if $(D hasLength!R) is $(D true). + Only defined if `hasLength!R` is `true`. +/ @property auto length() {assert(0);} @@ -7737,7 +7737,7 @@ assert(buffer2 == [11, 12, 13, 14, 15]); version(StdDdoc) { /++ - Only defined if $(D hasSlicing!R) is $(D true). + Only defined if `hasSlicing!R` is `true`. +/ auto opSlice(IndexType1, IndexType2) (IndexType1 begin, IndexType2 end) {assert(0);} @@ -8205,11 +8205,11 @@ struct NullSink of the range can be passed to a provided function or $(LREF OutputRange) as they are iterated over. This is useful for printing out intermediate values in a long chain of range code, performing some operation with - side-effects on each call to $(D front) or $(D popFront), or diverting + side-effects on each call to `front` or `popFront`, or diverting the elements of a range into an auxiliary $(LREF OutputRange). It is important to note that as the resultant range is evaluated lazily, - in the case of the version of $(D tee) that takes a function, the function + in the case of the version of `tee` that takes a function, the function will not actually be executed until the range is "walked" using functions that evaluate ranges, such as $(XREF array,array) or $(XREF algorithm,reduce). @@ -8288,7 +8288,7 @@ if (is(typeof(fun) == void) || isSomeFunction!fun) when using either as an $(LREF OutputRange). Since a template has no type, typeof(template) will always return void. If it's a template lambda, it's first necessary to instantiate - it with $(D ElementType!R1). + it with `ElementType!R1`. */ static if (is(typeof(fun) == void)) alias _fun = fun!(ElementType!R1); diff --git a/std/range/primitives.d b/std/range/primitives.d index af5df0f5177..fd095a4a442 100644 --- a/std/range/primitives.d +++ b/std/range/primitives.d @@ -8,7 +8,7 @@ $(BOOKTABLE , $(TR $(TD $(D $(LREF isInputRange))) $(TD Tests if something is an $(I input _range), defined to be something from which one can sequentially read data using the - primitives $(D front), $(D popFront), and $(D empty). + primitives `front`, `popFront`, and `empty`. )) $(TR $(TD $(D $(LREF isOutputRange))) $(TD Tests if something is an $(I output _range), defined to be @@ -18,18 +18,18 @@ $(BOOKTABLE , $(TR $(TD $(D $(LREF isForwardRange))) $(TD Tests if something is a $(I forward _range), defined to be an input _range with the additional capability that one can save one's - current position with the $(D save) primitive, thus allowing one to + current position with the `save` primitive, thus allowing one to iterate over the same _range multiple times. )) $(TR $(TD $(D $(LREF isBidirectionalRange))) $(TD Tests if something is a $(I bidirectional _range), that is, a forward _range that allows reverse traversal using the primitives $(D - back) and $(D popBack). + back) and `popBack`. )) $(TR $(TD $(D $(LREF isRandomAccessRange))) $(TD Tests if something is a $(I random access _range), which is a bidirectional _range that also supports the array subscripting - operation via the primitive $(D opIndex). + operation via the primitive `opIndex`. )) ) @@ -38,7 +38,7 @@ It also provides number of templates that test for various _range capabilities: $(BOOKTABLE , $(TR $(TD $(D $(LREF hasMobileElements))) $(TD Tests if a given _range's elements can be moved around using the - primitives $(D moveFront), $(D moveBack), or $(D moveAt). + primitives `moveFront`, `moveBack`, or `moveAt`. )) $(TR $(TD $(D $(LREF ElementType))) $(TD Returns the element type of a given _range. @@ -57,7 +57,7 @@ $(BOOKTABLE , passed by reference and have their address taken. )) $(TR $(TD $(D $(LREF hasLength))) - $(TD Tests if a given _range has the $(D length) attribute. + $(TD Tests if a given _range has the `length` attribute. )) $(TR $(TD $(D $(LREF isInfinite))) $(TD Tests if a given _range is an $(I infinite _range). @@ -118,8 +118,8 @@ module std.range.primitives; import std.traits; /** -Returns $(D true) if $(D R) is an input range. An input range must -define the primitives $(D empty), $(D popFront), and $(D front). The +Returns `true` if `R` is an input range. An input range must +define the primitives `empty`, `popFront`, and `front`. The following code should compile for any input range. ---- @@ -130,15 +130,15 @@ auto h = r.front; // can get the front of the range of non-void type ---- The semantics of an input range (not checkable during compilation) are -assumed to be the following ($(D r) is an object of type $(D R)): +assumed to be the following (`r` is an object of type `R`): -$(UL $(LI $(D r.empty) returns $(D false) iff there is more data -available in the range.) $(LI $(D r.front) returns the current +$(UL $(LI `r.empty` returns `false` iff there is more data +available in the range.) $(LI `r.front` returns the current element in the range. It may return by value or by reference. Calling -$(D r.front) is allowed only if calling $(D r.empty) has, or would -have, returned $(D false).) $(LI $(D r.popFront) advances to the next -element in the range. Calling $(D r.popFront) is allowed only if -calling $(D r.empty) has, or would have, returned $(D false).)) +`r.front` is allowed only if calling `r.empty` has, or would +have, returned `false`.) $(LI `r.popFront` advances to the next +element in the range. Calling `r.popFront` is allowed only if +calling `r.empty` has, or would have, returned `false`.)) */ template isInputRange(R) { @@ -170,13 +170,13 @@ template isInputRange(R) } /+ -puts the whole raw element $(D e) into $(D r). doPut will not attempt to -iterate, slice or transcode $(D e) in any way shape or form. It will $(B only) -call the correct primitive ($(D r.put(e)), $(D r.front = e) or -$(D r(0)) once. +puts the whole raw element `e` into `r`. doPut will not attempt to +iterate, slice or transcode `e` in any way shape or form. It will $(B only) +call the correct primitive (`r.put(e)`, $(D r.front = e) or +`r(0)` once. -This can be important when $(D e) needs to be placed in $(D r) unchanged. -Furthermore, it can be useful when working with $(D InputRange)s, as doPut +This can be important when `e` needs to be placed in `r` unchanged. +Furthermore, it can be useful when working with `InputRange`s, as doPut guarantees that no more than a single element will be placed. +/ private void doPut(R, E)(ref R r, auto ref E e) @@ -236,14 +236,14 @@ private void doPut(R, E)(ref R r, auto ref E e) } /++ -Outputs $(D e) to $(D r). The exact effect is dependent upon the two +Outputs `e` to `r`. The exact effect is dependent upon the two types. Several cases are accepted, as described below. The code snippets are attempted in order, and the first to compile "wins" and gets evaluated. -In this table "doPut" is a method that places $(D e) into $(D r), using the -correct primitive: $(D r.put(e)) if $(D R) defines $(D put), $(D r.front = e) -if $(D r) is an input range (followed by $(D r.popFront())), or $(D r(e)) +In this table "doPut" is a method that places `e` into `r`, using the +correct primitive: `r.put(e)` if `R` defines `put`, $(D r.front = e) +if `r` is an input range (followed by `r.popFront()`), or `r(e)` otherwise. $(BOOKTABLE , @@ -252,27 +252,27 @@ $(BOOKTABLE , $(TH Scenario) ) $(TR - $(TD $(D r.doPut(e);)) - $(TD $(D R) specifically accepts an $(D E).) + $(TD `r.doPut(e);`) + $(TD `R` specifically accepts an `E`.) ) $(TR $(TD $(D r.doPut([ e ]);)) - $(TD $(D R) specifically accepts an $(D E[]).) + $(TD `R` specifically accepts an `E[]`.) ) $(TR - $(TD $(D r.putChar(e);)) - $(TD $(D R) accepts some form of string or character. put will - transcode the character $(D e) accordingly.) + $(TD `r.putChar(e);`) + $(TD `R` accepts some form of string or character. put will + transcode the character `e` accordingly.) ) $(TR $(TD $(D for (; !e.empty; e.popFront()) put(r, e.front);)) - $(TD Copying range $(D E) into $(D R).) + $(TD Copying range `E` into `R`.) ) ) -Tip: $(D put) should $(I not) be used "UFCS-style", e.g. $(D r.put(e)). -Doing this may call $(D R.put) directly, by-passing any transformation -feature provided by $(D Range.put). $(D put(r, e)) is prefered. +Tip: `put` should $(I not) be used "UFCS-style", e.g. `r.put(e)`. +Doing this may call `R.put` directly, by-passing any transformation +feature provided by `Range.put`. $(D put(r, e)) is prefered. +/ void put(R, E)(ref R r, E e) { @@ -637,15 +637,15 @@ unittest } /+ -Returns $(D true) if $(D R) is a native output range for elements of type -$(D E). An output range is defined functionally as a range that +Returns `true` if `R` is a native output range for elements of type +`E`. An output range is defined functionally as a range that supports the operation $(D doPut(r, e)) as defined above. if $(D doPut(r, e)) -is valid, then $(D put(r,e)) will have the same behavior. +is valid, then `put(r,e)` will have the same behavior. -The two guarantees isNativeOutputRange gives over the larger $(D isOutputRange) +The two guarantees isNativeOutputRange gives over the larger `isOutputRange` are: -1: $(D e) is $(B exactly) what will be placed (not $(D [e]), for example). -2: if $(D E) is a non $(empty) $(D InputRange), then placing $(D e) is +1: `e` is $(B exactly) what will be placed (not `[e]`, for example). +2: if `E` is a non $(empty) `InputRange`, then placing `e` is guaranteed to not overflow the range. +/ package template isNativeOutputRange(R, E) @@ -673,8 +673,8 @@ package template isNativeOutputRange(R, E) put(r, [1, 2]); //May actually error out. } /++ -Returns $(D true) if $(D R) is an output range for elements of type -$(D E). An output range is defined functionally as a range that +Returns `true` if `R` is an output range for elements of type +`E`. An output range is defined functionally as a range that supports the operation $(D put(r, e)) as defined above. +/ template isOutputRange(R, E) @@ -721,9 +721,9 @@ template isOutputRange(R, E) /** -Returns $(D true) if $(D R) is a forward range. A forward range is an -input range $(D r) that can save "checkpoints" by saving $(D r.save) -to another value of type $(D R). Notable examples of input ranges that +Returns `true` if `R` is a forward range. A forward range is an +input range `r` that can save "checkpoints" by saving `r.save` +to another value of type `R`. Notable examples of input ranges that are $(I not) forward ranges are file/socket ranges; copying such a range will not save the position in the stream, and they most likely reuse an internal buffer as the entire stream does not sit in @@ -738,14 +738,14 @@ R r1; static assert (is(typeof(r1.save) == R)); ---- -Saving a range is not duplicating it; in the example above, $(D r1) -and $(D r2) still refer to the same underlying data. They just +Saving a range is not duplicating it; in the example above, `r1` +and `r2` still refer to the same underlying data. They just navigate that data independently. The semantics of a forward range (not checkable during compilation) are the same as for an input range, with the additional requirement that backtracking must be possible by saving a copy of the range -object with $(D save) and using it later. +object with `save` and using it later. */ template isForwardRange(R) { @@ -765,9 +765,9 @@ template isForwardRange(R) } /** -Returns $(D true) if $(D R) is a bidirectional range. A bidirectional -range is a forward range that also offers the primitives $(D back) and -$(D popBack). The following code should compile for any bidirectional +Returns `true` if `R` is a bidirectional range. A bidirectional +range is a forward range that also offers the primitives `back` and +`popBack`. The following code should compile for any bidirectional range. ---- @@ -780,12 +780,12 @@ static assert(is(typeof(t) == typeof(w))); // same type for front and back ---- The semantics of a bidirectional range (not checkable during -compilation) are assumed to be the following ($(D r) is an object of -type $(D R)): +compilation) are assumed to be the following (`r` is an object of +type `R`): -$(UL $(LI $(D r.back) returns (possibly a reference to) the last -element in the range. Calling $(D r.back) is allowed only if calling -$(D r.empty) has, or would have, returned $(D false).)) +$(UL $(LI `r.back` returns (possibly a reference to) the last +element in the range. Calling `r.back` is allowed only if calling +`r.empty` has, or would have, returned `false`.)) */ template isBidirectionalRange(R) { @@ -827,10 +827,10 @@ template isBidirectionalRange(R) } /** -Returns $(D true) if $(D R) is a random-access range. A random-access +Returns `true` if `R` is a random-access range. A random-access range is a bidirectional range that also offers the primitive $(D -opIndex), OR an infinite forward range that offers $(D opIndex). In -either case, the range must either offer $(D length) or be +opIndex), OR an infinite forward range that offers `opIndex`. In +either case, the range must either offer `length` or be infinite. The following code should compile for any random-access range. @@ -858,13 +858,13 @@ static if(is(typeof(r[$]))) ---- The semantics of a random-access range (not checkable during -compilation) are assumed to be the following ($(D r) is an object of -type $(D R)): $(UL $(LI $(D r.opIndex(n)) returns a reference to the -$(D n)th element in the range.)) +compilation) are assumed to be the following (`r` is an object of +type `R`): $(UL $(LI `r.opIndex(n)` returns a reference to the +`n`th element in the range.)) -Although $(D char[]) and $(D wchar[]) (as well as their qualified -versions including $(D string) and $(D wstring)) are arrays, $(D -isRandomAccessRange) yields $(D false) for them because they use +Although `char[]` and `wchar[]` (as well as their qualified +versions including `string` and `wstring`) are arrays, $(D +isRandomAccessRange) yields `false` for them because they use variable-length encodings (UTF-8 and UTF-16 respectively). These types are bidirectional ranges only. */ @@ -959,10 +959,10 @@ template isRandomAccessRange(R) } /** -Returns $(D true) iff $(D R) is an input range that supports the -$(D moveFront) primitive, as well as $(D moveBack) and $(D moveAt) if it's a +Returns `true` iff `R` is an input range that supports the +`moveFront` primitive, as well as `moveBack` and `moveAt` if it's a bidirectional or random access range. These may be explicitly implemented, or -may work via the default behavior of the module level functions $(D moveFront) +may work via the default behavior of the module level functions `moveFront` and friends. The following code should compile for any range with mobile elements. @@ -1016,12 +1016,12 @@ template hasMobileElements(R) } /** -The element type of $(D R). $(D R) does not have to be a range. The -element type is determined as the type yielded by $(D r.front) for an -object $(D r) of type $(D R). For example, $(D ElementType!(T[])) is -$(D T) if $(D T[]) isn't a narrow string; if it is, the element type is -$(D dchar). If $(D R) doesn't have $(D front), $(D ElementType!R) is -$(D void). +The element type of `R`. `R` does not have to be a range. The +element type is determined as the type yielded by `r.front` for an +object `r` of type `R`. For example, `ElementType!(T[])` is +`T` if `T[]` isn't a narrow string; if it is, the element type is +`dchar`. If `R` doesn't have `front`, `ElementType!R` is +`void`. */ template ElementType(R) { @@ -1103,11 +1103,11 @@ template ElementType(R) } /** -The encoding element type of $(D R). For narrow strings ($(D char[]), -$(D wchar[]) and their qualified variants including $(D string) and -$(D wstring)), $(D ElementEncodingType) is the character type of the -string. For all other types, $(D ElementEncodingType) is the same as -$(D ElementType). +The encoding element type of `R`. For narrow strings (`char[]`, +`wchar[]` and their qualified variants including `string` and +`wstring`), `ElementEncodingType` is the character type of the +string. For all other types, `ElementEncodingType` is the same as +`ElementType`. */ template ElementEncodingType(R) { @@ -1168,7 +1168,7 @@ template ElementEncodingType(R) } /** -Returns $(D true) if $(D R) is an input range and has swappable +Returns `true` if `R` is an input range and has swappable elements. The following code should compile for any range with swappable elements. @@ -1208,7 +1208,7 @@ template hasSwappableElements(R) } /** -Returns $(D true) if $(D R) is an input range and has mutable +Returns `true` if `R` is an input range and has mutable elements. The following code should compile for any range with assignable elements. @@ -1247,7 +1247,7 @@ template hasAssignableElements(R) } /** -Tests whether the range $(D R) has lvalue elements. These are defined as +Tests whether the range `R` has lvalue elements. These are defined as elements that can be passed by reference and have their address taken. The following code should compile for any range with lvalue elements. ---- @@ -1302,16 +1302,16 @@ template hasLvalueElements(R) } /** -Returns $(D true) if $(D R) has a $(D length) member that returns an -integral type. $(D R) does not have to be a range. Note that $(D +Returns `true` if `R` has a `length` member that returns an +integral type. `R` does not have to be a range. Note that $(D length) is an optional primitive as no range must implement it. Some ranges do not store their length explicitly, some cannot compute it without actually exhausting the range (e.g. socket streams), and some other ranges may be infinite. -Although narrow string types ($(D char[]), $(D wchar[]), and their -qualified derivatives) do define a $(D length) property, $(D -hasLength) yields $(D false) for them. This is because a narrow +Although narrow string types (`char[]`, `wchar[]`, and their +qualified derivatives) do define a `length` property, $(D +hasLength) yields `false` for them. This is because a narrow string's length does not reflect the number of characters, but instead the number of encoding units, and as such is not useful with range-oriented algorithms. @@ -1342,9 +1342,9 @@ template hasLength(R) } /** -Returns $(D true) if $(D R) is an infinite input range. An +Returns `true` if `R` is an infinite input range. An infinite input range is an input range that has a statically-defined -enumerated member called $(D empty) that is always $(D false), +enumerated member called `empty` that is always `false`, for example: ---- @@ -1373,20 +1373,20 @@ template isInfinite(R) } /** -Returns $(D true) if $(D R) offers a slicing operator with integral boundaries +Returns `true` if `R` offers a slicing operator with integral boundaries that returns a forward range type. -For finite ranges, the result of $(D opSlice) must be of the same type as the -original range type. If the range defines $(D opDollar), then it must support +For finite ranges, the result of `opSlice` must be of the same type as the +original range type. If the range defines `opDollar`, then it must support subtraction. -For infinite ranges, when $(I not) using $(D opDollar), the result of -$(D opSlice) must be the result of $(LREF take) or $(LREF takeExactly) on the +For infinite ranges, when $(I not) using `opDollar`, the result of +`opSlice` must be the result of $(LREF take) or $(LREF takeExactly) on the original range (they both return the same type for infinite ranges). However, -when using $(D opDollar), the result of $(D opSlice) must be that of the +when using `opDollar`, the result of `opSlice` must be that of the original range type. -The following code must compile for $(D hasSlicing) to be $(D true): +The following code must compile for `hasSlicing` to be `true`: ---- R r = void; @@ -1503,23 +1503,23 @@ template hasSlicing(R) } /** -This is a best-effort implementation of $(D length) for any kind of +This is a best-effort implementation of `length` for any kind of range. -If $(D hasLength!Range), simply returns $(D range.length) without -checking $(D upTo) (when specified). +If `hasLength!Range`, simply returns `range.length` without +checking `upTo` (when specified). Otherwise, walks the range through its length and returns the number -of elements seen. Performes $(BIGOH n) evaluations of $(D range.empty) -and $(D range.popFront()), where $(D n) is the effective length of $(D +of elements seen. Performes $(BIGOH n) evaluations of `range.empty` +and `range.popFront()`, where `n` is the effective length of $(D range). -The $(D upTo) parameter is useful to "cut the losses" in case +The `upTo` parameter is useful to "cut the losses" in case the interest is in seeing whether the range has at least some number -of elements. If the parameter $(D upTo) is specified, stops if $(D -upTo) steps have been taken and returns $(D upTo). +of elements. If the parameter `upTo` is specified, stops if $(D +upTo) steps have been taken and returns `upTo`. -Infinite ranges are compatible, provided the parameter $(D upTo) is +Infinite ranges are compatible, provided the parameter `upTo` is specified, in which case the implementation simply returns upTo. */ auto walkLength(Range)(Range range) @@ -1580,17 +1580,17 @@ auto walkLength(Range)(Range range, const size_t upTo) } /** - Eagerly advances $(D r) itself (not a copy) up to $(D n) times (by - calling $(D r.popFront)). $(D popFrontN) takes $(D r) by $(D ref), + Eagerly advances `r` itself (not a copy) up to `n` times (by + calling `r.popFront`). `popFrontN` takes `r` by `ref`, so it mutates the original range. Completes in $(BIGOH 1) steps for ranges that support slicing and have length. Completes in $(BIGOH n) time for all other ranges. Returns: - How much $(D r) was actually advanced, which may be less than $(D n) if - $(D r) did not have at least $(D n) elements. + How much `r` was actually advanced, which may be less than `n` if + `r` did not have at least `n` elements. - $(D popBackN) will behave the same but instead removes elements from + `popBackN` will behave the same but instead removes elements from the back of the (bidirectional) range instead of the front. */ size_t popFrontN(Range)(ref Range r, size_t n) @@ -1707,21 +1707,21 @@ size_t popBackN(Range)(ref Range r, size_t n) } /** - Eagerly advances $(D r) itself (not a copy) exactly $(D n) times (by - calling $(D r.popFront)). $(D popFrontExactly) takes $(D r) by $(D ref), + Eagerly advances `r` itself (not a copy) exactly `n` times (by + calling `r.popFront`). `popFrontExactly` takes `r` by `ref`, so it mutates the original range. Completes in $(BIGOH 1) steps for ranges that support slicing, and have either length or are infinite. Completes in $(BIGOH n) time for all other ranges. - Note: Unlike $(LREF popFrontN), $(D popFrontExactly) will assume that the - range holds at least $(D n) elements. This makes $(D popFrontExactly) - faster than $(D popFrontN), but it also means that if $(D range) does - not contain at least $(D n) elements, it will attempt to call $(D popFront) + Note: Unlike $(LREF popFrontN), `popFrontExactly` will assume that the + range holds at least `n` elements. This makes `popFrontExactly` + faster than `popFrontN`, but it also means that if `range` does + not contain at least `n` elements, it will attempt to call `popFront` on an empty range, which is undefined behavior. So, only use - $(D popFrontExactly) when it is guaranteed that $(D range) holds at least - $(D n) elements. + `popFrontExactly` when it is guaranteed that `range` holds at least + `n` elements. - $(D popBackExactly) will behave the same but instead removes elements from + `popBackExactly` will behave the same but instead removes elements from the back of the (bidirectional) range instead of the front. */ void popFrontExactly(Range)(ref Range r, size_t n) @@ -1780,9 +1780,9 @@ void popBackExactly(Range)(ref Range r, size_t n) } /** - Moves the front of $(D r) out and returns it. Leaves $(D r.front) in a + Moves the front of `r` out and returns it. Leaves `r.front` in a destroyable state that does not allocate any resources (usually equal - to its $(D .init) value). + to its `.init` value). */ ElementType!R moveFront(R)(R r) { @@ -1829,9 +1829,9 @@ ElementType!R moveFront(R)(R r) } /** - Moves the back of $(D r) out and returns it. Leaves $(D r.back) in a + Moves the back of `r` out and returns it. Leaves `r.back` in a destroyable state that does not allocate any resources (usually equal - to its $(D .init) value). + to its `.init` value). */ ElementType!R moveBack(R)(R r) { @@ -1868,9 +1868,9 @@ ElementType!R moveBack(R)(R r) } /** - Moves element at index $(D i) of $(D r) out and returns it. Leaves $(D + Moves element at index `i` of `r` out and returns it. Leaves $(D r.front) in a destroyable state that does not allocate any resources - (usually equal to its $(D .init) value). + (usually equal to its `.init` value). */ ElementType!R moveAt(R, I)(R r, I i) if (isIntegral!I) { @@ -1916,10 +1916,10 @@ ElementType!R moveAt(R, I)(R r, I i) if (isIntegral!I) } /** -Implements the range interface primitive $(D empty) for built-in +Implements the range interface primitive `empty` for built-in arrays. Due to the fact that nonmember functions can be called with -the first argument using the dot notation, $(D array.empty) is -equivalent to $(D empty(array)). +the first argument using the dot notation, `array.empty` is +equivalent to `empty(array)`. */ @property bool empty(T)(in T[] a) @safe pure nothrow @@ -1936,10 +1936,10 @@ equivalent to $(D empty(array)). } /** -Implements the range interface primitive $(D save) for built-in +Implements the range interface primitive `save` for built-in arrays. Due to the fact that nonmember functions can be called with -the first argument using the dot notation, $(D array.save) is -equivalent to $(D save(array)). The function does not duplicate the +the first argument using the dot notation, `array.save` is +equivalent to `save(array)`. The function does not duplicate the content of the array, it simply returns its argument. */ @@ -1956,11 +1956,11 @@ content of the array, it simply returns its argument. assert(b is a); } /** -Implements the range interface primitive $(D popFront) for built-in +Implements the range interface primitive `popFront` for built-in arrays. Due to the fact that nonmember functions can be called with -the first argument using the dot notation, $(D array.popFront) is -equivalent to $(D popFront(array)). For $(GLOSSARY narrow strings), -$(D popFront) automatically advances to the next $(GLOSSARY code +the first argument using the dot notation, `array.popFront` is +equivalent to `popFront(array)`. For $(GLOSSARY narrow strings), +`popFront` automatically advances to the next $(GLOSSARY code point). */ @@ -2056,10 +2056,10 @@ if (isNarrowString!(C[])) } /** -Implements the range interface primitive $(D popBack) for built-in +Implements the range interface primitive `popBack` for built-in arrays. Due to the fact that nonmember functions can be called with -the first argument using the dot notation, $(D array.popBack) is -equivalent to $(D popBack(array)). For $(GLOSSARY narrow strings), $(D +the first argument using the dot notation, `array.popBack` is +equivalent to `popBack(array)`. For $(GLOSSARY narrow strings), $(D popFront) automatically eliminates the last $(GLOSSARY code point). */ @@ -2122,10 +2122,10 @@ if (isNarrowString!(T[])) } /** -Implements the range interface primitive $(D front) for built-in +Implements the range interface primitive `front` for built-in arrays. Due to the fact that nonmember functions can be called with -the first argument using the dot notation, $(D array.front) is -equivalent to $(D front(array)). For $(GLOSSARY narrow strings), $(D +the first argument using the dot notation, `array.front` is +equivalent to `front(array)`. For $(GLOSSARY narrow strings), $(D front) automatically returns the first $(GLOSSARY code point) as a $(D dchar). */ @@ -2166,10 +2166,10 @@ if (!isNarrowString!(T[]) && !is(T[] == void[])) } /** -Implements the range interface primitive $(D back) for built-in +Implements the range interface primitive `back` for built-in arrays. Due to the fact that nonmember functions can be called with -the first argument using the dot notation, $(D array.back) is -equivalent to $(D back(array)). For $(GLOSSARY narrow strings), $(D +the first argument using the dot notation, `array.back` is +equivalent to `back(array)`. For $(GLOSSARY narrow strings), $(D back) automatically returns the last $(GLOSSARY code point) as a $(D dchar). */ diff --git a/std/regex/internal/ir.d b/std/regex/internal/ir.d index f2172bd77b3..7b935cd04cd 100644 --- a/std/regex/internal/ir.d +++ b/std/regex/internal/ir.d @@ -430,8 +430,8 @@ struct Group(DataIndex) } /++ - $(D Regex) object holds regular expression pattern in compiled form. - Instances of this object are constructed via calls to $(D regex). + `Regex` object holds regular expression pattern in compiled form. + Instances of this object are constructed via calls to `regex`. This is an intended form for caching and storage of frequently used regular expressions. +/ diff --git a/std/regex/package.d b/std/regex/package.d index f421919cda2..5abd95e9fbb 100644 --- a/std/regex/package.d +++ b/std/regex/package.d @@ -33,7 +33,7 @@ ... - // The result of the $(D matchAll) is directly testable with if/assert/while. + // The result of the `matchAll` is directly testable with if/assert/while. // e.g. test if a string consists of letters: assert(matchFirst("Letter", `^\p{L}+$`)); @@ -47,7 +47,7 @@ Checks of this sort of are better addressed by additional post-processing. The basic syntax shouldn't surprise experienced users of regular expressions. - For an introduction to $(D std.regex) see a + For an introduction to `std.regex` see a $(WEB dlang.org/regular-expression.html, short tour) of the module API and its abilities. @@ -203,7 +203,7 @@ A set of functions in this module that do the substitution rely on a simple format to guide the process. In particular the table below - applies to the $(D format) argument of + applies to the `format` argument of $(LREF replaceFirst) and $(LREF replaceAll). The format string can reference parts of match using the following notation. @@ -221,7 +221,7 @@ $(SECTION Slicing and zero memory allocations orientation) All matches returned by pattern matching functionality in this library - are slices of the original input. The notable exception is the $(D replace) + are slices of the original input. The notable exception is the `replace` family of functions that generate a new string from the input. In cases where producing the replacement is the ultimate goal @@ -234,7 +234,7 @@ Authors: Dmitry Olshansky, - API and utility constructs are modeled after the original $(D std.regex) + API and utility constructs are modeled after the original `std.regex` by Walter Bright and Andrei Alexandrescu. Source: $(PHOBOSSRC std/_regex.d) @@ -254,9 +254,9 @@ import std.regex.internal.thompson; //TODO: get rid of this dependency import std.exception, std.traits, std.range; /++ - $(D Regex) object holds regular expression pattern in compiled form. + `Regex` object holds regular expression pattern in compiled form. - Instances of this object are constructed via calls to $(D regex). + Instances of this object are constructed via calls to `regex`. This is an intended form for caching and storage of frequently used regular expressions. @@ -288,24 +288,24 @@ import std.exception, std.traits, std.range; public alias Regex(Char) = std.regex.internal.ir.Regex!(Char); /++ - A $(D StaticRegex) is $(D Regex) object that contains D code specially + A `StaticRegex` is `Regex` object that contains D code specially generated at compile-time to speed up matching. - Implicitly convertible to normal $(D Regex), + Implicitly convertible to normal `Regex`, however doing so will result in losing this additional capability. +/ public alias StaticRegex(Char) = std.regex.internal.ir.StaticRegex!(Char); /++ Compile regular expression pattern for the later execution. - Returns: $(D Regex) object that works on inputs having - the same character width as $(D pattern). + Returns: `Regex` object that works on inputs having + the same character width as `pattern`. Params: pattern = Regular expression flags = The _attributes (g, i, m and x accepted) - Throws: $(D RegexException) if there were any errors during compilation. + Throws: `RegexException` if there were any errors during compilation. +/ @trusted public auto regex(S)(S pattern, const(char)[] flags="") if(isSomeString!(S)) @@ -359,8 +359,8 @@ enum isRegexFor(RegEx, R) = is(RegEx == Regex!(BasicElementOf!R)) /++ - $(D Captures) object contains submatches captured during a call - to $(D match) or iteration over $(D RegexMatch) range. + `Captures` object contains submatches captured during a call + to `match` or iteration over `RegexMatch` range. First element of range is the whole match. +/ @@ -538,13 +538,13 @@ unittest } /++ - A regex engine state, as returned by $(D match) family of functions. + A regex engine state, as returned by `match` family of functions. Effectively it's a forward range of Captures!R, produced by lazily searching for matches in a given input. $(D alias Engine) specifies an engine type to use during matching, - and is automatically deduced in a call to $(D match)/$(D bmatch). + and is automatically deduced in a call to `match`/`bmatch`. +/ @trusted public struct RegexMatch(R, alias Engine = ThompsonMatcher) if(isSomeString!R) @@ -758,7 +758,7 @@ private R replaceAllWith(alias output, /++ - Start matching $(D input) to regex pattern $(D re), + Start matching `input` to regex pattern `re`, using Thompson NFA matching scheme. The use of this function is $(RED discouraged) - use either of @@ -770,7 +770,7 @@ private R replaceAllWith(alias output, matching scheme to use depends highly on the pattern kind and can done automatically on case by case basis. - Returns: a $(D RegexMatch) object holding engine state after first match. + Returns: a `RegexMatch` object holding engine state after first match. +/ public auto match(R, RegEx)(R input, RegEx re) @@ -796,11 +796,11 @@ public auto match(R, RegEx)(R input, RegEx re) } /++ - Find the first (leftmost) slice of the $(D input) that - matches the pattern $(D re). This function picks the most suitable + Find the first (leftmost) slice of the `input` that + matches the pattern `re`. This function picks the most suitable regular expression engine depending on the pattern properties. - $(D re) parameter can be one of three types: + `re` parameter can be one of three types: $(UL $(LI Plain string, in which case it's compiled to bytecode before matching. ) $(LI Regex!char (wchar/dchar) that contains a pattern in the form of @@ -836,14 +836,14 @@ public auto matchFirst(R, RegEx)(R input, RegEx re) } /++ - Initiate a search for all non-overlapping matches to the pattern $(D re) - in the given $(D input). The result is a lazy range of matches generated + Initiate a search for all non-overlapping matches to the pattern `re` + in the given `input`. The result is a lazy range of matches generated as they are encountered in the input going left to right. This function picks the most suitable regular expression engine depending on the pattern properties. - $(D re) parameter can be one of three types: + `re` parameter can be one of three types: $(UL $(LI Plain string, in which case it's compiled to bytecode before matching. ) $(LI Regex!char (wchar/dchar) that contains a pattern in the form of @@ -920,7 +920,7 @@ public auto matchAll(R, RegEx)(R input, RegEx re) } /++ - Start matching of $(D input) to regex pattern $(D re), + Start matching of `input` to regex pattern `re`, using traditional $(LUCKY backtracking) matching scheme. The use of this function is $(RED discouraged) - use either of @@ -932,7 +932,7 @@ public auto matchAll(R, RegEx)(R input, RegEx re) matching scheme to use depends highly on the pattern kind and can done automatically on case by case basis. - Returns: a $(D RegexMatch) object holding engine + Returns: a `RegexMatch` object holding engine state after first match. +/ @@ -1030,8 +1030,8 @@ L_Replace_Loop: } /++ - Construct a new string from $(D input) by replacing the first match with - a string generated from it according to the $(D format) specifier. + Construct a new string from `input` by replacing the first match with + a string generated from it according to the `format` specifier. To replace all matches use $(LREF replaceAll). @@ -1058,18 +1058,18 @@ public R replaceFirst(R, C, RegEx)(R input, RegEx re, const(C)[] format) /++ This is a general replacement tool that construct a new string by replacing - matches of pattern $(D re) in the $(D input). Unlike the other overload + matches of pattern `re` in the `input`. Unlike the other overload there is no format string instead captures are passed to - to a user-defined functor $(D fun) that returns a new string + to a user-defined functor `fun` that returns a new string to use as replacement. - This version replaces the first match in $(D input), + This version replaces the first match in `input`, see $(LREF replaceAll) to replace the all of the matches. Returns: - A new string of the same type as $(D input) with all matches - replaced by return values of $(D fun). If no matches found - returns the $(D input) itself. + A new string of the same type as `input` with all matches + replaced by return values of `fun`. If no matches found + returns the `input` itself. Example: --- @@ -1087,11 +1087,11 @@ public R replaceFirst(alias fun, R, RegEx)(R input, RegEx re) /++ A variation on $(LREF replaceFirst) that instead of allocating a new string - on each call outputs the result piece-wise to the $(D sink). In particular + on each call outputs the result piece-wise to the `sink`. In particular this enables efficient construction of a final output incrementally. Like in $(LREF replaceFirst) family of functions there is an overload - for the substitution guided by the $(D format) string + for the substitution guided by the `format` string and the one with the user defined callback. Example: @@ -1142,9 +1142,9 @@ public @trusted void replaceFirstInto(alias fun, Sink, R, RegEx) } /++ - Construct a new string from $(D input) by replacing all of the - fragments that match a pattern $(D re) with a string generated - from the match according to the $(D format) specifier. + Construct a new string from `input` by replacing all of the + fragments that match a pattern `re` with a string generated + from the match according to the `format` specifier. To replace only the first match use $(LREF replaceFirst). @@ -1155,7 +1155,7 @@ public @trusted void replaceFirstInto(alias fun, Sink, R, RegEx) see $(S_LINK Replace format string, the format string). Returns: - A string of the same type as $(D input) with the all + A string of the same type as `input` with the all of the matches (if any) replaced. If no match is found returns the input string itself. @@ -1174,18 +1174,18 @@ public @trusted R replaceAll(R, C, RegEx)(R input, RegEx re, const(C)[] format) /++ This is a general replacement tool that construct a new string by replacing - matches of pattern $(D re) in the $(D input). Unlike the other overload + matches of pattern `re` in the `input`. Unlike the other overload there is no format string instead captures are passed to - to a user-defined functor $(D fun) that returns a new string + to a user-defined functor `fun` that returns a new string to use as replacement. - This version replaces all of the matches found in $(D input), + This version replaces all of the matches found in `input`, see $(LREF replaceFirst) to replace the first match only. Returns: - A new string of the same type as $(D input) with all matches - replaced by return values of $(D fun). If no matches found - returns the $(D input) itself. + A new string of the same type as `input` with all matches + replaced by return values of `fun`. If no matches found + returns the `input` itself. Params: input = string to search @@ -1212,7 +1212,7 @@ public @trusted R replaceAll(alias fun, R, RegEx)(R input, RegEx re) /++ A variation on $(LREF replaceAll) that instead of allocating a new string - on each call outputs the result piece-wise to the $(D sink). In particular + on each call outputs the result piece-wise to the `sink`. In particular this enables efficient construction of a final output incrementally. As with $(LREF replaceAll) there are 2 overloads - one with a format string, @@ -1303,7 +1303,7 @@ public @trusted void replaceAllInto(alias fun, Sink, R, RegEx) } /++ - Old API for replacement, operation depends on flags of pattern $(D re). + Old API for replacement, operation depends on flags of pattern `re`. With "g" flag it performs the equivalent of $(LREF replaceAll) otherwise it works the same as $(LREF replaceFirst). @@ -1405,7 +1405,7 @@ public: } /** - A helper function, creates a $(D Splitter) on range $(D r) separated by regex $(D pat). + A helper function, creates a `Splitter` on range `r` separated by regex `pat`. Captured subexpressions have no effect on the resulting range. */ public Splitter!(Range, RegEx) splitter(Range, RegEx)(Range r, RegEx pat) @@ -1414,7 +1414,7 @@ public Splitter!(Range, RegEx) splitter(Range, RegEx)(Range r, RegEx pat) return Splitter!(Range, RegEx)(r, pat); } -///An eager version of $(D splitter) that creates an array with splitted slices of $(D input). +///An eager version of `splitter` that creates an array with splitted slices of `input`. public @trusted String[] split(String, RegEx)(String input, RegEx rx) if(isSomeString!String && isRegexFor!(RegEx, String)) { diff --git a/std/socket.d b/std/socket.d index f4db5357906..63bbf5dde3b 100644 --- a/std/socket.d +++ b/std/socket.d @@ -142,7 +142,7 @@ version(unittest) } } -/// Base exception thrown by $(D std.socket). +/// Base exception thrown by `std.socket`. class SocketException: Exception { /// @@ -310,7 +310,7 @@ class SocketFeatureException: SocketException } -/// Return $(D true) if the last socket operation failed because the socket +/// Return `true` if the last socket operation failed because the socket /// was in non-blocking mode and the operation would have blocked. bool wouldHaveBlocked() nothrow @nogc { @@ -438,7 +438,7 @@ else /** - * $(D Protocol) is a class for retrieving protocol information. + * `Protocol` is a class for retrieving protocol information. * * Example: * --- @@ -534,7 +534,7 @@ unittest /** - * $(D Service) is a class for retrieving service information. + * `Service` is a class for retrieving service information. * * Example: * --- @@ -645,7 +645,7 @@ unittest /** - * Class for exceptions thrown from an $(D InternetHost). + * Class for exceptions thrown from an `InternetHost`. */ class HostException: SocketOSException { @@ -669,9 +669,9 @@ class HostException: SocketOSException } /** - * $(D InternetHost) is a class for resolving IPv4 addresses. + * `InternetHost` is a class for resolving IPv4 addresses. * - * Consider using $(D getAddress), $(D parseAddress) and $(D Address) methods + * Consider using `getAddress`, `parseAddress` and `Address` methods * instead of using this class directly. * * Example: @@ -892,27 +892,27 @@ unittest } -/// Holds information about a socket _address retrieved by $(D getAddressInfo). +/// Holds information about a socket _address retrieved by `getAddressInfo`. struct AddressInfo { AddressFamily family; /// Address _family SocketType type; /// Socket _type ProtocolType protocol; /// Protocol Address address; /// Socket _address - string canonicalName; /// Canonical name, when $(D AddressInfoFlags.CANONNAME) is used. + string canonicalName; /// Canonical name, when `AddressInfoFlags.CANONNAME` is used. } // A subset of flags supported on all platforms with getaddrinfo. -/// Specifies option flags for $(D getAddressInfo). +/// Specifies option flags for `getAddressInfo`. enum AddressInfoFlags: int { - /// The resulting addresses will be used in a call to $(D Socket.bind). + /// The resulting addresses will be used in a call to `Socket.bind`. PASSIVE = AI_PASSIVE, - /// The canonical name is returned in $(D canonicalName) member in the first $(D AddressInfo). + /// The canonical name is returned in `canonicalName` member in the first `AddressInfo`. CANONNAME = AI_CANONNAME, - /// The $(D node) parameter passed to $(D getAddressInfo) must be a numeric string. + /// The `node` parameter passed to `getAddressInfo` must be a numeric string. /// This will suppress any potentially lengthy network host address lookups. NUMERICHOST = AI_NUMERICHOST, } @@ -936,21 +936,21 @@ private string formatGaiError(int err) @trusted /** * Provides _protocol-independent translation from host names to socket * addresses. If advanced functionality is not required, consider using - * $(D getAddress) for compatibility with older systems. + * `getAddress` for compatibility with older systems. * - * Returns: Array with one $(D AddressInfo) per socket address. + * Returns: Array with one `AddressInfo` per socket address. * - * Throws: $(D SocketOSException) on failure, or $(D SocketFeatureException) + * Throws: `SocketOSException` on failure, or `SocketFeatureException` * if this functionality is not available on the current system. * * Params: * node = string containing host name or numeric address * options = optional additional parameters, identified by type: - * $(UL $(LI $(D string) - service name or port number) - * $(LI $(D AddressInfoFlags) - option flags) - * $(LI $(D AddressFamily) - address family to filter by) - * $(LI $(D SocketType) - socket type to filter by) - * $(LI $(D ProtocolType) - protocol to filter by)) + * $(UL $(LI `string` - service name or port number) + * $(LI `AddressInfoFlags` - option flags) + * $(LI `AddressFamily` - address family to filter by) + * $(LI `SocketType` - socket type to filter by) + * $(LI `ProtocolType` - protocol to filter by)) * * Example: * --- @@ -1100,12 +1100,12 @@ private ushort serviceToPort(in char[] service) /** * Provides _protocol-independent translation from host names to socket - * addresses. Uses $(D getAddressInfo) if the current system supports it, - * and $(D InternetHost) otherwise. + * addresses. Uses `getAddressInfo` if the current system supports it, + * and `InternetHost` otherwise. * - * Returns: Array with one $(D Address) instance per socket address. + * Returns: Array with one `Address` instance per socket address. * - * Throws: $(D SocketOSException) on failure. + * Throws: `SocketOSException` on failure. * * Example: * --- @@ -1179,13 +1179,13 @@ unittest /** * Provides _protocol-independent parsing of network addresses. Does not - * attempt name resolution. Uses $(D getAddressInfo) with - * $(D AddressInfoFlags.NUMERICHOST) if the current system supports it, and - * $(D InternetAddress) otherwise. + * attempt name resolution. Uses `getAddressInfo` with + * `AddressInfoFlags.NUMERICHOST` if the current system supports it, and + * `InternetAddress` otherwise. * - * Returns: An $(D Address) instance representing specified address. + * Returns: An `Address` instance representing specified address. * - * Throws: $(D SocketException) on failure. + * Throws: `SocketException` on failure. * * Example: * --- @@ -1260,7 +1260,7 @@ unittest /** - * Class for exceptions thrown from an $(D Address). + * Class for exceptions thrown from an `Address`. */ class AddressException: SocketOSException { @@ -1285,7 +1285,7 @@ class AddressException: SocketOSException /** - * $(D Address) is an abstract class for representing a socket addresses. + * `Address` is an abstract class for representing a socket addresses. * * Example: * --- @@ -1310,11 +1310,11 @@ class AddressException: SocketOSException */ abstract class Address { - /// Returns pointer to underlying $(D sockaddr) structure. + /// Returns pointer to underlying `sockaddr` structure. abstract @property sockaddr* name() pure nothrow @nogc; abstract @property const(sockaddr)* name() const pure nothrow @nogc; /// ditto - /// Returns actual size of underlying $(D sockaddr) structure. + /// Returns actual size of underlying `sockaddr` structure. abstract @property socklen_t nameLen() const pure nothrow @nogc; /// Family of this address. @@ -1387,7 +1387,7 @@ abstract class Address /** * Attempts to retrieve the host address as a human-readable string. * - * Throws: $(D AddressException) on failure, or $(D SocketFeatureException) + * Throws: `AddressException` on failure, or `SocketFeatureException` * if address retrieval for this address family is not available on the * current system. */ @@ -1399,10 +1399,10 @@ abstract class Address /** * Attempts to retrieve the host name as a fully qualified domain name. * - * Returns: The FQDN corresponding to this $(D Address), or $(D null) if + * Returns: The FQDN corresponding to this `Address`, or `null` if * the host name did not resolve. * - * Throws: $(D AddressException) on error, or $(D SocketFeatureException) + * Throws: `AddressException` on error, or `SocketFeatureException` * if host name lookup for this address family is not available on the * current system. */ @@ -1414,7 +1414,7 @@ abstract class Address /** * Attempts to retrieve the numeric port number as a string. * - * Throws: $(D AddressException) on failure, or $(D SocketFeatureException) + * Throws: `AddressException` on failure, or `SocketFeatureException` * if port number retrieval for this address family is not available on the * current system. */ @@ -1426,7 +1426,7 @@ abstract class Address /** * Attempts to retrieve the service name as a string. * - * Throws: $(D AddressException) on failure, or $(D SocketFeatureException) + * Throws: `AddressException` on failure, or `SocketFeatureException` * if service name lookup for this address family is not available on the * current system. */ @@ -1453,7 +1453,7 @@ abstract class Address } /** - * $(D UnknownAddress) encapsulates an unknown socket address. + * `UnknownAddress` encapsulates an unknown socket address. */ class UnknownAddress: Address { @@ -1482,7 +1482,7 @@ public: /** - * $(D UnknownAddressReference) encapsulates a reference to an arbitrary + * `UnknownAddressReference` encapsulates a reference to an arbitrary * socket address. */ class UnknownAddressReference: Address @@ -1492,14 +1492,14 @@ protected: socklen_t len; public: - /// Constructs an $(D Address) with a reference to the specified $(D sockaddr). + /// Constructs an `Address` with a reference to the specified `sockaddr`. this(sockaddr* sa, socklen_t len) pure nothrow @nogc { this.sa = sa; this.len = len; } - /// Constructs an $(D Address) with a copy of the specified $(D sockaddr). + /// Constructs an `Address` with a copy of the specified `sockaddr`. this(const(sockaddr)* sa, socklen_t len) @system pure nothrow { this.sa = cast(sockaddr*) (cast(ubyte*)sa)[0..len].dup.ptr; @@ -1525,10 +1525,10 @@ public: /** - * $(D InternetAddress) encapsulates an IPv4 (Internet Protocol version 4) + * `InternetAddress` encapsulates an IPv4 (Internet Protocol version 4) * socket address. * - * Consider using $(D getAddress), $(D parseAddress) and $(D Address) methods + * Consider using `getAddress`, `parseAddress` and `Address` methods * instead of using this class directly. */ class InternetAddress: Address @@ -1577,10 +1577,10 @@ public: } /** - * Construct a new $(D InternetAddress). + * Construct a new `InternetAddress`. * Params: * addr = an IPv4 address string in the dotted-decimal form a.b.c.d, - * or a host name which will be resolved using an $(D InternetHost) + * or a host name which will be resolved using an `InternetHost` * object. * port = port number, may be $(D PORT_ANY). */ @@ -1602,7 +1602,7 @@ public: } /** - * Construct a new $(D InternetAddress). + * Construct a new `InternetAddress`. * Params: * addr = (optional) an IPv4 address in host byte order, may be $(D ADDR_ANY). * port = port number, may be $(D PORT_ANY). @@ -1637,10 +1637,10 @@ public: /** * Attempts to retrieve the host name as a fully qualified domain name. * - * Returns: The FQDN corresponding to this $(D InternetAddress), or - * $(D null) if the host name did not resolve. + * Returns: The FQDN corresponding to this `InternetAddress`, or + * `null` if the host name did not resolve. * - * Throws: $(D AddressException) on error. + * Throws: `AddressException` on error. */ override string toHostNameString() const { @@ -1751,10 +1751,10 @@ unittest /** - * $(D Internet6Address) encapsulates an IPv6 (Internet Protocol version 6) + * `Internet6Address` encapsulates an IPv6 (Internet Protocol version 6) * socket address. * - * Consider using $(D getAddress), $(D parseAddress) and $(D Address) methods + * Consider using `getAddress`, `parseAddress` and `Address` methods * instead of using this class directly. */ class Internet6Address: Address @@ -1820,10 +1820,10 @@ public: } /** - * Construct a new $(D Internet6Address). + * Construct a new `Internet6Address`. * Params: * addr = an IPv6 host address string in the form described in RFC 2373, - * or a host name which will be resolved using $(D getAddressInfo). + * or a host name which will be resolved using `getAddressInfo`. * service = (optional) service name. */ this(in char[] addr, in char[] service = null) @trusted @@ -1834,10 +1834,10 @@ public: } /** - * Construct a new $(D Internet6Address). + * Construct a new `Internet6Address`. * Params: * addr = an IPv6 host address string in the form described in RFC 2373, - * or a host name which will be resolved using $(D getAddressInfo). + * or a host name which will be resolved using `getAddressInfo`. * port = port number, may be $(D PORT_ANY). */ this(in char[] addr, ushort port) @@ -1849,7 +1849,7 @@ public: } /** - * Construct a new $(D Internet6Address). + * Construct a new `Internet6Address`. * Params: * addr = (optional) an IPv6 host address in host byte order, or * $(D ADDR_ANY). @@ -1873,7 +1873,7 @@ public: /** * Parse an IPv6 host address string as described in RFC 2373, and return the * address. - * Throws: $(D SocketException) on error. + * Throws: `SocketException` on error. */ static ubyte[16] parse(in char[] addr) @trusted { @@ -1900,12 +1900,12 @@ unittest version(StdDdoc) { /** - * $(D UnixAddress) encapsulates an address for a Unix domain socket + * `UnixAddress` encapsulates an address for a Unix domain socket * ($(D AF_UNIX)). Available only on supported systems. */ class UnixAddress: Address { - /// Construct a new $(D UnixAddress) from the specified path. + /// Construct a new `UnixAddress` from the specified path. this(in char[] path); /// Get the underlying _path. @@ -2006,7 +2006,7 @@ static if (is(sockaddr_un)) /** - * Class for exceptions thrown by $(D Socket.accept). + * Class for exceptions thrown by `Socket.accept`. */ class SocketAcceptException: SocketOSException { @@ -2088,10 +2088,10 @@ struct TimeVal /** - * A collection of sockets for use with $(D Socket.select). + * A collection of sockets for use with `Socket.select`. * - * $(D SocketSet) wraps the platform $(D fd_set) type. However, unlike - * $(D fd_set), $(D SocketSet) is not statically limited to $(D FD_SETSIZE) + * `SocketSet` wraps the platform $(D fd_set) type. However, unlike + * $(D fd_set), `SocketSet` is not statically limited to $(D FD_SETSIZE) * or any other limit, and grows as needed. */ class SocketSet @@ -2207,7 +2207,7 @@ public: reset(); } - /// Reset the $(D SocketSet) so that there are 0 $(D Socket)s in the collection. + /// Reset the `SocketSet` so that there are 0 `Socket`s in the collection. void reset() pure nothrow @nogc { version (Windows) @@ -2248,7 +2248,7 @@ public: } } - /// Add a $(D Socket) to the collection. + /// Add a `Socket` to the collection. /// The socket must not already be in the collection. void add(Socket s) pure nothrow { @@ -2276,7 +2276,7 @@ public: } - /// Remove this $(D Socket) from the collection. + /// Remove this `Socket` from the collection. /// Does nothing if the socket is not in the collection already. void remove(Socket s) pure nothrow { @@ -2300,17 +2300,17 @@ public: } - /// Return nonzero if this $(D Socket) is in the collection. + /// Return nonzero if this `Socket` is in the collection. int isSet(Socket s) const pure nothrow @nogc { return isSet(s.sock); } - /// Return the current capacity of this $(D SocketSet). The exact + /// Return the current capacity of this `SocketSet`. The exact /// meaning of the return value varies from platform to platform. /// Note that since D 2.065, this value does not indicate a - /// restriction, and $(D SocketSet) will grow its capacity as + /// restriction, and `SocketSet` will grow its capacity as /// needed automatically. @property uint max() const pure nothrow @nogc { @@ -2536,7 +2536,7 @@ enum SocketOption: int /** - * $(D Socket) is a class that creates a network communication endpoint using + * `Socket` is a class that creates a network communication endpoint using * the Berkeley sockets interface. */ class Socket @@ -2604,7 +2604,7 @@ public: /** * Create a blocking socket. If a single protocol type exists to support - * this socket type within the address family, the $(D ProtocolType) may be + * this socket type within the address family, the `ProtocolType` may be * omitted. */ this(AddressFamily af, SocketType type, ProtocolType protocol) @trusted @@ -2639,7 +2639,7 @@ public: /** * Create a blocking socket using the parameters from the specified - * $(D AddressInfo) structure. + * `AddressInfo` structure. */ this(in AddressInfo info) { @@ -2770,9 +2770,9 @@ public: } /** - * Listen for an incoming connection. $(D bind) must be called before you - * can $(D listen). The $(D backlog) is a request of how many pending - * incoming connections are queued until $(D accept)ed. + * Listen for an incoming connection. `bind` must be called before you + * can `listen`. The `backlog` is a request of how many pending + * incoming connections are queued until `accept`ed. */ void listen(int backlog) @trusted { @@ -2781,10 +2781,10 @@ public: } /** - * Called by $(D accept) when a new $(D Socket) must be created for a new + * Called by `accept` when a new `Socket` must be created for a new * connection. To use a derived class, override this method and return an - * instance of your class. The returned $(D Socket)'s handle must not be - * set; $(D Socket) has a protected constructor $(D this()) to use in this + * instance of your class. The returned `Socket`'s handle must not be + * set; `Socket` has a protected constructor `this()` to use in this * situation. */ // Override to use a derived class. @@ -2795,9 +2795,9 @@ public: } /** - * Accept an incoming connection. If the socket is blocking, $(D accept) - * waits for a connection request. Throws $(D SocketAcceptException) if - * unable to _accept. See $(D accepting) for use with derived classes. + * Accept an incoming connection. If the socket is blocking, `accept` + * waits for a connection request. Throws `SocketAcceptException` if + * unable to _accept. See `accepting` for use with derived classes. */ Socket accept() @trusted { @@ -2847,9 +2847,9 @@ public: /** * Immediately drop any connections and release socket resources. - * Calling $(D shutdown) before $(D close) is recommended for - * connection-oriented sockets. The $(D Socket) object is no longer - * usable after $(D close). + * Calling `shutdown` before `close` is recommended for + * connection-oriented sockets. The `Socket` object is no longer + * usable after `close`. */ //calling shutdown() before this is recommended //for connection-oriented sockets @@ -2870,7 +2870,7 @@ public: return to!string(result.ptr); } - /// Remote endpoint $(D Address). + /// Remote endpoint `Address`. @property Address remoteAddress() @trusted { Address addr = createAddress(); @@ -2883,7 +2883,7 @@ public: return addr; } - /// Local endpoint $(D Address). + /// Local endpoint `Address`. @property Address localAddress() @trusted { Address addr = createAddress(); @@ -2897,16 +2897,16 @@ public: } /** - * Send or receive error code. See $(D wouldHaveBlocked), - * $(D lastSocketError) and $(D Socket.getErrorText) for obtaining more + * Send or receive error code. See `wouldHaveBlocked`, + * `lastSocketError` and `Socket.getErrorText` for obtaining more * information about the error. */ enum int ERROR = _SOCKET_ERROR; /** * Send data on the connection. If the socket is blocking and there is no - * buffer space left, $(D send) waits. - * Returns: The number of bytes actually sent, or $(D Socket.ERROR) on + * buffer space left, `send` waits. + * Returns: The number of bytes actually sent, or `Socket.ERROR` on * failure. */ //returns number of bytes actually sent, or -1 on error @@ -2932,8 +2932,8 @@ public: /** * Send data to a specific destination Address. If the destination address is * not specified, a connection must have been made and that address is used. - * If the socket is blocking and there is no buffer space left, $(D sendTo) waits. - * Returns: The number of bytes actually sent, or $(D Socket.ERROR) on + * If the socket is blocking and there is no buffer space left, `sendTo` waits. + * Returns: The number of bytes actually sent, or `Socket.ERROR` on * failure. */ ptrdiff_t sendTo(const(void)[] buf, SocketFlags flags, Address to) @trusted @@ -2982,10 +2982,10 @@ public: /** - * Receive data on the connection. If the socket is blocking, $(D receive) + * Receive data on the connection. If the socket is blocking, `receive` * waits until there is data to be received. - * Returns: The number of bytes actually received, $(D 0) if the remote side - * has closed the connection, or $(D Socket.ERROR) on failure. + * Returns: The number of bytes actually received, `0` if the remote side + * has closed the connection, or `Socket.ERROR` on failure. */ //returns number of bytes actually received, 0 on connection closure, or -1 on error ptrdiff_t receive(void[] buf, SocketFlags flags) @trusted @@ -3009,11 +3009,11 @@ public: } /** - * Receive data and get the remote endpoint $(D Address). - * If the socket is blocking, $(D receiveFrom) waits until there is data to + * Receive data and get the remote endpoint `Address`. + * If the socket is blocking, `receiveFrom` waits until there is data to * be received. - * Returns: The number of bytes actually received, $(D 0) if the remote side - * has closed the connection, or $(D Socket.ERROR) on failure. + * Returns: The number of bytes actually received, `0` if the remote side + * has closed the connection, or `Socket.ERROR` on failure. */ ptrdiff_t receiveFrom(void[] buf, SocketFlags flags, ref Address from) @trusted { @@ -3072,7 +3072,7 @@ public: /// Get a socket option. - /// Returns: The number of bytes written to $(D result). + /// Returns: The number of bytes written to `result`. //returns the length, in bytes, of the actual result - very different from getsockopt() int getOption(SocketOptionLevel level, SocketOption option, void[] result) @trusted { @@ -3145,8 +3145,8 @@ public: } /** - * Sets a timeout (duration) option, i.e. $(D SocketOption.SNDTIMEO) or - * $(D RCVTIMEO). Zero indicates no timeout. + * Sets a timeout (duration) option, i.e. `SocketOption.SNDTIMEO` or + * `RCVTIMEO`. Zero indicates no timeout. * * In a typical application, you might also want to consider using * a non-blocking socket instead of setting a timeout on a blocking one. @@ -3155,17 +3155,17 @@ public: * on *nix systems even for smaller durations, there are two issues to * be aware of on Windows: First, although undocumented, the effective * timeout duration seems to be the one set on the socket plus half - * a second. $(D setOption()) tries to compensate for that, but still, + * a second. `setOption()` tries to compensate for that, but still, * timeouts under 500ms are not possible on Windows. Second, be aware * that the actual amount of time spent until a blocking call returns * randomly varies on the order of 10ms. * * Params: * level = The level at which a socket option is defined. - * option = Either $(D SocketOption.SNDTIMEO) or $(D SocketOption.RCVTIMEO). + * option = Either `SocketOption.SNDTIMEO` or `SocketOption.RCVTIMEO`. * value = The timeout duration to set. Must not be negative. * - * Throws: $(D SocketException) if setting the options fails. + * Throws: `SocketException` if setting the options fails. * * Example: * --- @@ -3227,8 +3227,8 @@ public: * interval = Number of seconds between when successive keep-alive * packets are sent if no acknowledgement is received. * - * Throws: $(D SocketOSException) if setting the options fails, or - * $(D SocketFeatureException) if setting keep-alive parameters is + * Throws: `SocketOSException` if setting the options fails, or + * `SocketFeatureException` if setting keep-alive parameters is * unsupported on the current platform. */ void setKeepAlive(int time, int interval) @trusted @@ -3260,12 +3260,12 @@ public: /** * Wait for a socket to change status. A wait timeout of $(Duration) or - * $(D TimeVal), may be specified; if a timeout is not specified or the - * $(D TimeVal) is $(D null), the maximum timeout is used. The $(D TimeVal) - * timeout has an unspecified value when $(D select) returns. - * Returns: The number of sockets with status changes, $(D 0) on timeout, - * or $(D -1) on interruption. If the return value is greater than $(D 0), - * the $(D SocketSets) are updated to only contain the sockets having status + * `TimeVal`, may be specified; if a timeout is not specified or the + * `TimeVal` is `null`, the maximum timeout is used. The `TimeVal` + * timeout has an unspecified value when `select` returns. + * Returns: The number of sockets with status changes, `0` on timeout, + * or `-1` on interruption. If the return value is greater than `0`, + * the `SocketSets` are updated to only contain the sockets having status * changes. For a connecting socket, a write status change means the * connection is established and it's able to send. For a listening socket, * a read status change means there is an incoming connection request and @@ -3422,7 +3422,7 @@ public: } -/// $(D TcpSocket) is a shortcut class for a TCP Socket. +/// `TcpSocket` is a shortcut class for a TCP Socket. class TcpSocket: Socket { /// Constructs a blocking TCP Socket. @@ -3439,7 +3439,7 @@ class TcpSocket: Socket //shortcut - /// Constructs a blocking TCP Socket and connects to an $(D Address). + /// Constructs a blocking TCP Socket and connects to an `Address`. this(Address connectTo) { this(connectTo.addressFamily); @@ -3448,7 +3448,7 @@ class TcpSocket: Socket } -/// $(D UdpSocket) is a shortcut class for a UDP Socket. +/// `UdpSocket` is a shortcut class for a UDP Socket. class UdpSocket: Socket { /// Constructs a blocking UDP Socket. @@ -3470,7 +3470,7 @@ class UdpSocket: Socket * * The two sockets are indistinguishable. * - * Throws: $(D SocketException) if creation of the sockets fails. + * Throws: `SocketException` if creation of the sockets fails. * * Example: * --- diff --git a/std/socketstream.d b/std/socketstream.d index e89358eb6a4..4e8585a651c 100644 --- a/std/socketstream.d +++ b/std/socketstream.d @@ -25,8 +25,8 @@ * current standards. It will remain until we have a suitable replacement, * but be aware that it will not remain long term.) * - * $(D SocketStream) is a stream for a blocking, - * connected $(D Socket). + * `SocketStream` is a stream for a blocking, + * connected `Socket`. * * Example: * See $(SAMPLESRC htmlget.d) @@ -43,8 +43,8 @@ private import std.stream; private import std.socket; /************** - * $(D SocketStream) is a stream for a blocking, - * connected $(D Socket). + * `SocketStream` is a stream for a blocking, + * connected `Socket`. */ class SocketStream: Stream { @@ -76,7 +76,7 @@ class SocketStream: Stream } /** - * Property to get the $(D Socket) that is being streamed. + * Property to get the `Socket` that is being streamed. */ Socket socket() { @@ -121,7 +121,7 @@ class SocketStream: Stream /** * Socket streams do not support seeking. This disabled method throws - * a $(D SeekException). + * a `SeekException`. */ @disable override ulong seek(long offset, SeekPos whence) { @@ -138,7 +138,7 @@ class SocketStream: Stream } /** - * Close the $(D Socket). + * Close the `Socket`. */ override void close() { diff --git a/std/stdio.d b/std/stdio.d index 1fe7c9f79c4..1ab460a746a 100644 --- a/std/stdio.d +++ b/std/stdio.d @@ -25,7 +25,7 @@ import std.traits;// Unqual, isSomeChar, isSomeString /++ -If flag $(D KeepTerminator) is set to $(D KeepTerminator.yes), then the delimiter +If flag `KeepTerminator` is set to `KeepTerminator.yes`, then the delimiter is included in the strings returned. +/ alias KeepTerminator = Flag!"keepTerminator"; @@ -278,19 +278,19 @@ template byRecord(Fields...) } /** -Encapsulates a $(D FILE*). Generally D does not attempt to provide +Encapsulates a `FILE*`. Generally D does not attempt to provide thin wrappers over equivalent functions in the C standard library, but -manipulating $(D FILE*) values directly is unsafe and error-prone in -many ways. The $(D File) type ensures safe manipulation, automatic +manipulating `FILE*` values directly is unsafe and error-prone in +many ways. The `File` type ensures safe manipulation, automatic file closing, and a lot of convenience. -The underlying $(D FILE*) handle is maintained in a reference-counted -manner, such that as soon as the last $(D File) variable bound to a -given $(D FILE*) goes out of scope, the underlying $(D FILE*) is +The underlying `FILE*` handle is maintained in a reference-counted +manner, such that as soon as the last `File` variable bound to a +given `FILE*` goes out of scope, the underlying `FILE*` is automatically closed. Bugs: -$(D File) expects file names to be encoded in $(B CP_ACP) on $(I Windows) +`File` expects file names to be encoded in $(B CP_ACP) on $(I Windows) instead of UTF-8 ($(BUGZILLA 7648)) thus must not be used in $(I Windows) or cross-platform applications other than with an immediate ASCII string as a file name to prevent accidental changes to result in incorrect behavior. @@ -313,7 +313,7 @@ void main(string args[]) } f.writeln("!"); // f exits scope, reference count falls to zero, - // underlying $(D FILE*) is closed. + // underlying `FILE*` is closed. } ----
@@ -356,13 +356,13 @@ Constructor taking the name of the file to open and the open mode
 cplusplus.com/reference/clibrary/cstdio/fopen.html, fopen)
 function).
 
-Copying one $(D File) object to another results in the two $(D File)
+Copying one `File` object to another results in the two `File`
 objects referring to the same underlying file.
 
-The destructor automatically closes the file as soon as no $(D File)
+The destructor automatically closes the file as soon as no `File`
 object refers to it anymore.
 
-Throws: $(D ErrnoException) if the file could not be opened.
+Throws: `ErrnoException` if the file could not be opened.
  */
     this(string name, in char[] stdioOpenmode = "rb") @safe
     {
@@ -400,12 +400,12 @@ file.
     }
 
 /**
-First calls $(D detach) (throwing on failure), and then attempts to
-_open file $(D name) with mode $(D stdioOpenmode). The mode has the
+First calls `detach` (throwing on failure), and then attempts to
+_open file `name` with mode `stdioOpenmode`. The mode has the
 same semantics as in the C standard library $(WEB
 cplusplus.com/reference/clibrary/cstdio/fopen.html, fopen) function.
 
-Throws: $(D ErrnoException) in case of error.
+Throws: `ErrnoException` in case of error.
  */
     void open(string name, in char[] stdioOpenmode = "rb") @safe
     {
@@ -414,11 +414,11 @@ Throws: $(D ErrnoException) in case of error.
     }
 
 /**
-First calls $(D detach) (throwing on failure), and then runs a command
+First calls `detach` (throwing on failure), and then runs a command
 by calling the C standard library function $(WEB
 opengroup.org/onlinepubs/007908799/xsh/_popen.html, _popen).
 
-Throws: $(D ErrnoException) in case of error.
+Throws: `ErrnoException` in case of error.
  */
     version(Posix) void popen(string command, in char[] stdioOpenmode = "r") @safe
     {
@@ -431,11 +431,11 @@ Throws: $(D ErrnoException) in case of error.
     }
 
 /**
-First calls $(D detach) (throwing on failure), and then attempts to
-associate the given file descriptor with the $(D File). The mode must
+First calls `detach` (throwing on failure), and then attempts to
+associate the given file descriptor with the `File`. The mode must
 be compatible with the mode of the file descriptor.
 
-Throws: $(D ErrnoException) in case of error.
+Throws: `ErrnoException` in case of error.
  */
     void fdopen(int fd, in char[] stdioOpenmode = "rb") @safe
     {
@@ -484,11 +484,11 @@ Throws: $(D ErrnoException) in case of error.
     version(StdDdoc) { version(Windows) {} else alias HANDLE = int; }
 
 /**
-First calls $(D detach) (throwing on failure), and then attempts to
-associate the given Windows $(D HANDLE) with the $(D File). The mode must
+First calls `detach` (throwing on failure), and then attempts to
+associate the given Windows `HANDLE` with the `File`. The mode must
 be compatible with the access attributes of the handle. Windows only.
 
-Throws: $(D ErrnoException) in case of error.
+Throws: `ErrnoException` in case of error.
 */
     version(StdDdoc)
     void windowsHandleOpen(HANDLE handle, in char[] stdioOpenmode);
@@ -526,17 +526,17 @@ Throws: $(D ErrnoException) in case of error.
     }
 
 
-/** Returns $(D true) if the file is opened. */
+/** Returns `true` if the file is opened. */
     @property bool isOpen() const @safe pure nothrow
     {
         return _p !is null && _p.handle;
     }
 
 /**
-Returns $(D true) if the file is at end (see $(WEB
+Returns `true` if the file is at end (see $(WEB
 cplusplus.com/reference/clibrary/cstdio/feof.html, feof)).
 
-Throws: $(D Exception) if the file is not opened.
+Throws: `Exception` if the file is not opened.
  */
     @property bool eof() const @trusted pure
     {
@@ -547,7 +547,7 @@ Throws: $(D Exception) if the file is not opened.
     }
 
 /** Returns the name of the last opened file, if any.
-If a $(D File) was created with $(LREF tmpfile) and $(LREF wrapFile)
+If a `File` was created with $(LREF tmpfile) and $(LREF wrapFile)
 it has no name.*/
     @property string name() const @safe pure nothrow
     {
@@ -555,7 +555,7 @@ it has no name.*/
     }
 
 /**
-If the file is not opened, returns $(D false). Otherwise, returns
+If the file is not opened, returns `false`. Otherwise, returns
 $(WEB cplusplus.com/reference/clibrary/cstdio/ferror.html, ferror) for
 the file handle.
  */
@@ -577,9 +577,9 @@ the file handle.
     }
 
 /**
-Detaches from the underlying file. If the sole owner, calls $(D close).
+Detaches from the underlying file. If the sole owner, calls `close`.
 
-Throws: $(D ErrnoException) on failure if closing the file.
+Throws: `ErrnoException` on failure if closing the file.
   */
     void detach() @safe
     {
@@ -614,11 +614,11 @@ If the file was unopened, succeeds vacuously. Otherwise closes the
 file (by calling $(WEB
 cplusplus.com/reference/clibrary/cstdio/fclose.html, fclose)),
 throwing on error. Even if an exception is thrown, afterwards the $(D
-File) object is empty. This is different from $(D detach) in that it
-always closes the file; consequently, all other $(D File) objects
+File) object is empty. This is different from `detach` in that it
+always closes the file; consequently, all other `File` objects
 referring to the same handle will see a closed file henceforth.
 
-Throws: $(D ErrnoException) on error.
+Throws: `ErrnoException` on error.
  */
     void close() @trusted
     {
@@ -670,7 +670,7 @@ _clearerr) for the file handle.
 Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_fflush.html, _fflush)
 for the file handle.
 
-Throws: $(D Exception) if the file is not opened or if the call to $(D fflush) fails.
+Throws: `Exception` if the file is not opened or if the call to `fflush` fails.
  */
     void flush() @trusted
     {
@@ -699,14 +699,14 @@ Calls $(WEB cplusplus.com/reference/clibrary/cstdio/fread.html, fread) for the
 file handle. The number of items to read and the size of
 each item is inferred from the size and type of the input array, respectively.
 
-Returns: The slice of $(D buffer) containing the data that was actually read.
-This will be shorter than $(D buffer) if EOF was reached before the buffer
+Returns: The slice of `buffer` containing the data that was actually read.
+This will be shorter than `buffer` if EOF was reached before the buffer
 could be filled.
 
-Throws: $(D Exception) if $(D buffer) is empty.
-        $(D ErrnoException) if the file is not opened or the call to $(D fread) fails.
+Throws: `Exception` if `buffer` is empty.
+        `ErrnoException` if the file is not opened or the call to `fread` fails.
 
-$(D rawRead) always reads in binary mode on Windows.
+`rawRead` always reads in binary mode on Windows.
  */
     T[] rawRead(T)(T[] buffer)
     {
@@ -757,9 +757,9 @@ handle. The number of items to write and the size of each
 item is inferred from the size and type of the input array, respectively. An
 error is thrown if the buffer could not be written in its entirety.
 
-$(D rawWrite) always writes in binary mode on Windows.
+`rawWrite` always writes in binary mode on Windows.
 
-Throws: $(D ErrnoException) if the file is not opened or if the call to $(D fwrite) fails.
+Throws: `ErrnoException` if the file is not opened or if the call to `fwrite` fails.
  */
     void rawWrite(T)(in T[] buffer)
     {
@@ -808,8 +808,8 @@ Throws: $(D ErrnoException) if the file is not opened or if the call to $(D fwri
 Calls $(WEB cplusplus.com/reference/clibrary/cstdio/fseek.html, fseek)
 for the file handle.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) if the call to $(D fseek) fails.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` if the call to `fseek` fails.
  */
     void seek(long offset, int origin = SEEK_SET) @trusted
     {
@@ -867,8 +867,8 @@ Throws: $(D Exception) if the file is not opened.
 Calls $(WEB cplusplus.com/reference/clibrary/cstdio/ftell.html, ftell) for the
 managed file handle.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) if the call to $(D ftell) fails.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` if the call to `ftell` fails.
  */
     @property ulong tell() const @trusted
     {
@@ -907,7 +907,7 @@ Throws: $(D Exception) if the file is not opened.
 Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_rewind.html, _rewind)
 for the file handle.
 
-Throws: $(D Exception) if the file is not opened.
+Throws: `Exception` if the file is not opened.
  */
     void rewind() @safe
     {
@@ -921,8 +921,8 @@ Throws: $(D Exception) if the file is not opened.
 Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_setvbuf.html, _setvbuf) for
 the file handle.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) if the call to $(D setvbuf) fails.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` if the call to `setvbuf` fails.
  */
     void setvbuf(size_t size, int mode = _IOFBF) @trusted
     {
@@ -937,8 +937,8 @@ Throws: $(D Exception) if the file is not opened.
 Calls $(WEB cplusplus.com/reference/clibrary/cstdio/_setvbuf.html,
 _setvbuf) for the file handle.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) if the call to $(D setvbuf) fails.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` if the call to `setvbuf` fails.
 */
     void setvbuf(void[] buf, int mode = _IOFBF) @trusted
     {
@@ -1001,14 +1001,14 @@ Throws: $(D Exception) if the file is not opened.
 /**
 Locks the specified file segment. If the file segment is already locked
 by another process, waits until the existing lock is released.
-If both $(D start) and $(D length) are zero, the entire file is locked.
+If both `start` and `length` are zero, the entire file is locked.
 
-Locks created using $(D lock) and $(D tryLock) have the following properties:
+Locks created using `lock` and `tryLock` have the following properties:
 $(UL
  $(LI All locks are automatically released when the process terminates.)
  $(LI Locks are not inherited by child processes.)
  $(LI Closing a file will release all locks associated with the file. On POSIX,
-      even locks acquired via a different $(D File) will be released as well.)
+      even locks acquired via a different `File` will be released as well.)
  $(LI Not all NFS implementations correctly implement file locking.)
 )
  */
@@ -1040,8 +1040,8 @@ $(UL
 
 /**
 Attempts to lock the specified file segment.
-If both $(D start) and $(D length) are zero, the entire file is locked.
-Returns: $(D true) if the lock was successful, and $(D false) if the
+If both `start` and `length` are zero, the entire file is locked.
+Returns: `true` if the lock was successful, and `false` if the
 specified file segment was already locked.
  */
     bool tryLock(LockType lockType = LockType.readWrite,
@@ -1183,8 +1183,8 @@ Removes the lock over the specified file segment.
 /**
 Writes its arguments in text format to the file.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) on an error writing to the file.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` on an error writing to the file.
 */
     void write(S...)(S args)
     {
@@ -1232,8 +1232,8 @@ Throws: $(D Exception) if the file is not opened.
 /**
 Writes its arguments in text format to the file, followed by a newline.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) on an error writing to the file.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` on an error writing to the file.
 */
     void writeln(S...)(S args)
     {
@@ -1244,8 +1244,8 @@ Throws: $(D Exception) if the file is not opened.
 Writes its arguments in text format to the file, according to the
 format in the first argument.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) on an error writing to the file.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` on an error writing to the file.
 */
     void writef(Char, A...)(in Char[] fmt, A args)
     {
@@ -1258,8 +1258,8 @@ Throws: $(D Exception) if the file is not opened.
 Writes its arguments in text format to the file, according to the
 format in the first argument, followed by a newline.
 
-Throws: $(D Exception) if the file is not opened.
-        $(D ErrnoException) on an error writing to the file.
+Throws: `Exception` if the file is not opened.
+        `ErrnoException` on an error writing to the file.
 */
     void writefln(Char, A...)(in Char[] fmt, A args)
     {
@@ -1274,12 +1274,12 @@ Throws: $(D Exception) if the file is not opened.
 Read line from the file handle and return it as a specified type.
 
 This version manages its own read buffer, which means one memory allocation per call. If you are not
-retaining a reference to the read data, consider the $(D File.readln(buf)) version, which may offer
+retaining a reference to the read data, consider the `File.readln(buf)` version, which may offer
 better performance as it can reuse its read buffer.
 
 Params:
-    S = Template parameter; the type of the allocated buffer, and the type returned. Defaults to $(D string).
-    terminator = Line terminator (by default, $(D '\n')).
+    S = Template parameter; the type of the allocated buffer, and the type returned. Defaults to `string`.
+    terminator = Line terminator (by default, `'\n'`).
 
 Note:
     String terminators are not supported due to ambiguity with readln(buf) below.
@@ -1288,11 +1288,11 @@ Returns:
     The line that was read, including the line terminator character.
 
 Throws:
-    $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode conversion error.
+    `StdioException` on I/O error, or `UnicodeException` on Unicode conversion error.
 
 Example:
 ---
-// Reads $(D stdin) and writes it to $(D stdout).
+// Reads `stdin` and writes it to `stdout`.
 import std.stdio;
 
 void main()
@@ -1354,7 +1354,7 @@ void main()
     }
 
 /**
-Read line from the file handle and write it to $(D buf[]), including
+Read line from the file handle and write it to `buf[]`, including
 terminating character.
 
 This can be faster than $(D line = File.readln()) because you can reuse
@@ -1364,21 +1364,21 @@ must copy the previous contents if you wish to retain them.
 Params:
 buf = Buffer used to store the resulting line data. buf is
 resized as necessary.
-terminator = Line terminator (by default, $(D '\n')). Use
+terminator = Line terminator (by default, `'\n'`). Use
 $(XREF ascii, newline) for portability (unless the file was opened in
 text mode).
 
 Returns:
 0 for end of file, otherwise number of characters read
 
-Throws: $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode
+Throws: `StdioException` on I/O error, or `UnicodeException` on Unicode
 conversion error.
 
 Example:
 ---
-// Read lines from $(D stdin) into a string
+// Read lines from `stdin` into a string
 // Ignore lines starting with '#'
-// Write the string to $(D stdout)
+// Write the string to `stdout`
 
 void main()
 {
@@ -1398,8 +1398,8 @@ void main()
 ---
 
 This method can be more efficient than the one in the previous example
-because $(D stdin.readln(buf)) reuses (if possible) memory allocated
-for $(D buf), whereas $(D line = stdin.readln()) makes a new memory allocation
+because `stdin.readln(buf)` reuses (if possible) memory allocated
+for `buf`, whereas $(D line = stdin.readln()) makes a new memory allocation
 for every line.
 */
     size_t readln(C)(ref C[] buf, dchar terminator = '\n')
@@ -1522,7 +1522,7 @@ for every line.
     }
 
 /**
-Unsafe function that wraps an existing $(D FILE*). The resulting $(D
+Unsafe function that wraps an existing `FILE*`. The resulting $(D
 File) never takes the initiative in closing the file.
 Note that the created file has no $(LREF name)*/
     /*private*/ static File wrapFile(FILE* f) @safe
@@ -1534,7 +1534,7 @@ Note that the created file has no $(LREF name)*/
     }
 
 /**
-Returns the $(D FILE*) corresponding to this object.
+Returns the `FILE*` corresponding to this object.
  */
     FILE* getFP() @safe pure
     {
@@ -1563,7 +1563,7 @@ Returns the file number corresponding to this object.
     }
 
 /**
-Returns the underlying operating system $(D HANDLE) (Windows only).
+Returns the underlying operating system `HANDLE` (Windows only).
 */
     version(StdDdoc)
     @property HANDLE windowsHandle();
@@ -1703,21 +1703,21 @@ Allows to directly use range operations on lines of a file.
 Returns an input range set up to read from the file handle one line
 at a time.
 
-The element type for the range will be $(D Char[]). Range primitives
-may throw $(D StdioException) on I/O error.
+The element type for the range will be `Char[]`. Range primitives
+may throw `StdioException` on I/O error.
 
 Note:
-Each $(D front) will not persist after $(D
+Each `front` will not persist after $(D
 popFront) is called, so the caller must copy its contents (e.g. by
-calling $(D to!string)) when retention is needed. If the caller needs
+calling `to!string`) when retention is needed. If the caller needs
 to retain a copy of every line, use the $(LREF byLineCopy) function
 instead.
 
 Params:
-Char = Character type for each line, defaulting to $(D char).
-keepTerminator = Use $(D KeepTerminator.yes) to include the
+Char = Character type for each line, defaulting to `char`.
+keepTerminator = Use `KeepTerminator.yes` to include the
 terminator at the end of each line.
-terminator = Line separator ($(D '\n') by default). Use
+terminator = Line separator (`'\n'` by default). Use
 $(XREF ascii, newline) for portability (unless the file was opened in
 text mode).
 
@@ -1756,7 +1756,7 @@ void main()
 }
 ----
 Notice that neither example accesses the line data returned by
-$(D front) after the corresponding $(D popFront) call is made (because
+`front` after the corresponding `popFront` call is made (because
 the contents may well have changed).
 */
     auto byLine(Terminator = char, Char = char)
@@ -1846,20 +1846,20 @@ the contents may well have changed).
 
 /**
 Returns an input range set up to read from the file handle one line
-at a time. Each line will be newly allocated. $(D front) will cache
+at a time. Each line will be newly allocated. `front` will cache
 its value to allow repeated calls without unnecessary allocations.
 
 Note: Due to caching byLineCopy can be more memory-efficient than
-$(D File.byLine.map!idup).
+`File.byLine.map!idup`.
 
-The element type for the range will be $(D Char[]). Range
-primitives may throw $(D StdioException) on I/O error.
+The element type for the range will be `Char[]`. Range
+primitives may throw `StdioException` on I/O error.
 
 Params:
 Char = Character type for each line, defaulting to $(D immutable char).
-keepTerminator = Use $(D KeepTerminator.yes) to include the
+keepTerminator = Use `KeepTerminator.yes` to include the
 terminator at the end of each line.
-terminator = Line separator ($(D '\n') by default). Use
+terminator = Line separator (`'\n'` by default). Use
 $(XREF ascii, newline) for portability (unless the file was opened in
 text mode).
 
@@ -2107,7 +2107,7 @@ $(XREF file,readText)
             prime();
         }
 
-        // $(D ByChunk)'s input range primitive operations.
+        // `ByChunk`'s input range primitive operations.
         @property nothrow
         bool empty() const
         {
@@ -2144,8 +2144,8 @@ $(XREF file,readText)
 Returns an input range set up to read from the file handle a chunk at a
 time.
 
-The element type for the range will be $(D ubyte[]). Range primitives
-may throw $(D StdioException) on I/O error.
+The element type for the range will be `ubyte[]`. Range primitives
+may throw `StdioException` on I/O error.
 
 Example:
 ---------
@@ -2160,7 +2160,7 @@ void main()
 ---------
 
 The parameter may be a number (as shown in the example above) dictating the
-size of each chunk. Alternatively, $(D byChunk) accepts a
+size of each chunk. Alternatively, `byChunk` accepts a
 user-provided buffer that it uses directly.
 
 Example:
@@ -2176,14 +2176,14 @@ void main()
 ---------
 
 In either case, the content of the buffer is reused across calls. That means
-$(D front) will not persist after $(D popFront) is called, so if retention is
-needed, the caller must copy its contents (e.g. by calling $(D buffer.dup)).
+`front` will not persist after `popFront` is called, so if retention is
+needed, the caller must copy its contents (e.g. by calling `buffer.dup`).
 
-In the  example above, $(D buffer.length) is 4096 for all iterations, except
-for the last one, in which case $(D buffer.length) may be less than 4096 (but
+In the  example above, `buffer.length` is 4096 for all iterations, except
+for the last one, in which case `buffer.length` may be less than 4096 (but
 always greater than zero).
 
-With the mentioned limitations, $(D byChunks) works with any algorithm
+With the mentioned limitations, `byChunks` works with any algorithm
 compatible with input ranges.
 
 Example:
@@ -2196,12 +2196,12 @@ void main()
 }
 ---
 
-Returns: A call to $(D byChunk) returns a range initialized with the $(D File)
+Returns: A call to `byChunk` returns a range initialized with the `File`
 object and the appropriate buffer.
 
 Throws: If the user-provided size is zero or the user-provided buffer
-is empty, throws an $(D Exception). In case of an I/O error throws
-$(D StdioException).
+is empty, throws an `Exception`. In case of an I/O error throws
+`StdioException`.
  */
     auto byChunk(size_t chunkSize)
     {
@@ -2265,7 +2265,7 @@ $(D StdioException).
 
     // Note: This was documented until 2013/08
 /*
-$(D Range) that locks the file and allows fast writing to it.
+`Range` that locks the file and allows fast writing to it.
  */
     struct LockingTextWriter
     {
@@ -2637,7 +2637,7 @@ unittest
     assert(File(deleteme).readln() == "日本語日本語日本語日本語############");
 }
 
-/// Used to specify the lock type for $(D File.lock) and $(D File.tryLock).
+/// Used to specify the lock type for `File.lock` and `File.tryLock`.
 enum LockType
 {
     /// Specifies a _read (shared) lock. A _read lock denies all processes
@@ -2826,7 +2826,7 @@ unittest // bugzilla 12320
 }
 
 /**
- * Indicates whether $(D T) is a file handle of some kind.
+ * Indicates whether `T` is a file handle of some kind.
  */
 template isFileHandle(T)
 {
@@ -2841,7 +2841,7 @@ unittest
 }
 
 /**
- * $(RED Deprecated. Please use $(D isFileHandle) instead. This alias will be
+ * $(RED Deprecated. Please use `isFileHandle` instead. This alias will be
  *       removed in June 2015.)
  */
 deprecated("Please use isFileHandle instead.")
@@ -2853,12 +2853,12 @@ alias isStreamingDevice = isFileHandle;
 private @property File trustedStdout() @trusted { return stdout; }
 
 /***********************************
-For each argument $(D arg) in $(D args), format the argument (as per
+For each argument `arg` in `args`, format the argument (as per
 $(LINK2 std_conv.html, to!(string)(arg))) and write the resulting
-string to $(D args[0]). A call without any arguments will fail to
+string to `args[0]`. A call without any arguments will fail to
 compile.
 
-Throws: In case of an I/O error, throws an $(D StdioException).
+Throws: In case of an I/O error, throws an `StdioException`.
  */
 void write(T...)(T args) if (!is(T[0] : File))
 {
@@ -2892,7 +2892,7 @@ unittest
 }
 
 /***********************************
- * Equivalent to $(D write(args, '\n')).  Calling $(D writeln) without
+ * Equivalent to $(D write(args, '\n')).  Calling `writeln` without
  * arguments is valid and just prints a newline to the standard
  * output.
  */
@@ -3035,7 +3035,7 @@ unittest
 Writes formatted data to standard output (without a trailing newline).
 
 Params:
-args = The first argument $(D args[0]) should be the format string, specifying
+args = The first argument `args[0]` should be the format string, specifying
 how to format the rest of the arguments. For a full description of the syntax
 of the format string and how it controls the formatting of the rest of the
 arguments, please refer to the documentation for $(XREF format,
@@ -3047,7 +3047,7 @@ Note: In older versions of Phobos, it used to be possible to write:
 writef(stderr, "%s", "message");
 ------
 
-to print a message to $(D stderr). This syntax is no longer supported, and has
+to print a message to `stderr`. This syntax is no longer supported, and has
 been superceded by:
 
 ------
@@ -3133,7 +3133,7 @@ unittest
 }
 
 /**
- * Read data from $(D stdin) according to the specified
+ * Read data from `stdin` according to the specified
  * $(LINK2 std_format.html#format-string, format specifier) using
  * $(XREF format,formattedRead).
  */
@@ -3154,23 +3154,23 @@ unittest
 }
 
 /**********************************
- * Read line from $(D stdin).
+ * Read line from `stdin`.
  *
  * This version manages its own read buffer, which means one memory allocation per call. If you are not
- * retaining a reference to the read data, consider the $(D readln(buf)) version, which may offer
+ * retaining a reference to the read data, consider the `readln(buf)` version, which may offer
  * better performance as it can reuse its read buffer.
  *
  * Returns:
  *        The line that was read, including the line terminator character.
  * Params:
- *        S = Template parameter; the type of the allocated buffer, and the type returned. Defaults to $(D string).
- *        terminator = Line terminator (by default, $(D '\n')).
+ *        S = Template parameter; the type of the allocated buffer, and the type returned. Defaults to `string`.
+ *        terminator = Line terminator (by default, `'\n'`).
  * Note:
  *        String terminators are not supported due to ambiguity with readln(buf) below.
  * Throws:
- *        $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode conversion error.
+ *        `StdioException` on I/O error, or `UnicodeException` on Unicode conversion error.
  * Example:
- *        Reads $(D stdin) and writes it to $(D stdout).
+ *        Reads `stdin` and writes it to `stdout`.
 ---
 import std.stdio;
 
@@ -3189,7 +3189,7 @@ if (isSomeString!S)
 }
 
 /**********************************
- * Read line from $(D stdin) and write it to buf[], including terminating character.
+ * Read line from `stdin` and write it to buf[], including terminating character.
  *
  * This can be faster than $(D line = readln()) because you can reuse
  * the buffer for each call. Note that reusing the buffer means that you
@@ -3199,12 +3199,12 @@ if (isSomeString!S)
  *        $(D size_t) 0 for end of file, otherwise number of characters read
  * Params:
  *        buf = Buffer used to store the resulting line data. buf is resized as necessary.
- *        terminator = Line terminator (by default, $(D '\n')). Use $(XREF ascii, newline)
+ *        terminator = Line terminator (by default, `'\n'`). Use $(XREF ascii, newline)
  *        for portability (unless the file was opened in text mode).
  * Throws:
- *        $(D StdioException) on I/O error, or $(D UnicodeException) on Unicode conversion error.
+ *        `StdioException` on I/O error, or `UnicodeException` on Unicode conversion error.
  * Example:
- *        Reads $(D stdin) and writes it to $(D stdout).
+ *        Reads `stdin` and writes it to `stdout`.
 ---
 import std.stdio;
 
@@ -3256,7 +3256,7 @@ unittest
 }
 
 /*
- * Convenience function that forwards to $(D core.sys.posix.stdio.fopen)
+ * Convenience function that forwards to `core.sys.posix.stdio.fopen`
  * (to $(D _wfopen) on Windows)
  * with appropriately-constructed C-style strings.
  */
@@ -3291,7 +3291,7 @@ private FILE* fopen(in char[] name, in char[] mode = "r") @trusted nothrow @nogc
 version (Posix)
 {
     /***********************************
-     * Convenience function that forwards to $(D core.sys.posix.stdio.popen)
+     * Convenience function that forwards to `core.sys.posix.stdio.popen`
      * with appropriately-constructed C-style strings.
      */
     FILE* popen(in char[] name, in char[] mode = "r") @trusted nothrow @nogc
@@ -3304,7 +3304,7 @@ version (Posix)
 }
 
 /*
- * Convenience function that forwards to $(D core.stdc.stdio.fwrite)
+ * Convenience function that forwards to `core.stdc.stdio.fwrite`
  * and throws an exception upon error
  */
 private void binaryWrite(T)(FILE* f, T obj)
@@ -3314,7 +3314,7 @@ private void binaryWrite(T)(FILE* f, T obj)
 }
 
 /**
- * Iterates through the lines of a file by using $(D foreach).
+ * Iterates through the lines of a file by using `foreach`.
  *
  * Example:
  *
@@ -3327,24 +3327,24 @@ void main()
   }
 }
 ---------
-The line terminator ($(D '\n') by default) is part of the string read (it
+The line terminator (`'\n'` by default) is part of the string read (it
 could be missing in the last line of the file). Several types are
-supported for $(D line), and the behavior of $(D lines)
+supported for `line`, and the behavior of `lines`
 changes accordingly:
 
-$(OL $(LI If $(D line) has type $(D string), $(D
-wstring), or $(D dstring), a new string of the respective type
-is allocated every read.) $(LI If $(D line) has type $(D
-char[]), $(D wchar[]), $(D dchar[]), the line's content
-will be reused (overwritten) across reads.) $(LI If $(D line)
-has type $(D immutable(ubyte)[]), the behavior is similar to
+$(OL $(LI If `line` has type `string`, $(D
+wstring), or `dstring`, a new string of the respective type
+is allocated every read.) $(LI If `line` has type $(D
+char[]), `wchar[]`, `dchar[]`, the line's content
+will be reused (overwritten) across reads.) $(LI If `line`
+has type `immutable(ubyte)[]`, the behavior is similar to
 case (1), except that no UTF checking is attempted upon input.) $(LI
-If $(D line) has type $(D ubyte[]), the behavior is
+If `line` has type `ubyte[]`, the behavior is
 similar to case (2), except that no UTF checking is attempted upon
 input.))
 
 In all cases, a two-symbols versions is also accepted, in which case
-the first symbol (of integral type, e.g. $(D ulong) or $(D
+the first symbol (of integral type, e.g. `ulong` or $(D
 uint)) tracks the zero-based number of the current line.
 
 Example:
@@ -3355,7 +3355,7 @@ Example:
   }
 ----
 
- In case of an I/O error, an $(D StdioException) is thrown.
+ In case of an I/O error, an `StdioException` is thrown.
 
 See_Also:
 $(LREF byLine)
@@ -3371,7 +3371,7 @@ struct lines
     Constructor.
     Params:
     f = File to read lines from.
-    terminator = Line separator ($(D '\n') by default).
+    terminator = Line separator (`'\n'` by default).
     */
     this(File f, dchar terminator = '\n')
     {
@@ -3604,7 +3604,7 @@ unittest
 }
 
 /**
-Iterates through a file a chunk at a time by using $(D foreach).
+Iterates through a file a chunk at a time by using `foreach`.
 
 Example:
 
@@ -3618,12 +3618,12 @@ void main()
 }
 ---------
 
-The content of $(D buffer) is reused across calls. In the
- example above, $(D buffer.length) is 4096 for all iterations,
- except for the last one, in which case $(D buffer.length) may
+The content of `buffer` is reused across calls. In the
+ example above, `buffer.length` is 4096 for all iterations,
+ except for the last one, in which case `buffer.length` may
  be less than 4096 (but always greater than zero).
 
- In case of an I/O error, an $(D StdioException) is thrown.
+ In case of an I/O error, an `StdioException` is thrown.
 */
 auto chunks(File f, size_t size)
 {
@@ -3766,7 +3766,7 @@ Initialize with a message and an error code.
                      : (message.ptr ? message ~ " (" ~ sysmsg ~ ")" : sysmsg));
     }
 
-/** Convenience functions that throw an $(D StdioException). */
+/** Convenience functions that throw an `StdioException`. */
     static void opCall(string msg)
     {
         throw new StdioException(msg);
diff --git a/std/string.d b/std/string.d
index 6abdf396629..02ad18b809c 100644
--- a/std/string.d
+++ b/std/string.d
@@ -2,7 +2,7 @@
 
 /**
 String handling functions. Note that many typical string functions are found in 
-$(D std.algorithm) because all D strings are bidirectional ranges.
+`std.algorithm` because all D strings are bidirectional ranges.
 
 $(SCRIPT inhibitQuickIndex = 1;)
 
@@ -56,9 +56,9 @@ $(TR $(TDNW Miscellaneous)
 )
 )
 
-Objects of types $(D _string), $(D wstring), and $(D dstring) are value types
+Objects of types $(D _string), `wstring`, and `dstring` are value types
 and cannot be mutated element-by-element. For using mutation during building
-strings, use $(D char[]), $(D wchar[]), or $(D dchar[]). The $(D xxxstring)
+strings, use `char[]`, `wchar[]`, or `dchar[]`. The `xxxstring`
 types are preferable because they don't exhibit undesired aliasing, thus
 making code more robust.
 
@@ -137,7 +137,7 @@ class StringException : Exception
 
 
 /++
-    Returns a D-style array of $(D char) given a zero-terminated C-style string.
+    Returns a D-style array of `char` given a zero-terminated C-style string.
     The returned array will retain the same type qualifiers as the input.
 
     $(RED Important Note:) The returned array is a slice of the original buffer.
@@ -157,12 +157,12 @@ inout(char)[] fromStringz(inout(char)* cString) @system pure {
 }
 
 /++
-    Returns a C-style zero-terminated string equivalent to $(D s). $(D s)
-    must not contain embedded $(D '\0')'s as any C function will treat the first
-    $(D '\0') that it sees as the end of the string. If $(D s.empty) is
-    $(D true), then a string containing only $(D '\0') is returned.
+    Returns a C-style zero-terminated string equivalent to `s`. `s`
+    must not contain embedded `'\0'`'s as any C function will treat the first
+    `'\0'` that it sees as the end of the string. If `s.empty` is
+    `true`, then a string containing only `'\0'` is returned.
 
-    $(RED Important Note:) When passing a $(D char*) to a C function, and the C
+    $(RED Important Note:) When passing a `char*` to a C function, and the C
     function keeps it around for any reason, make sure that you keep a reference
     to it in your D code. Otherwise, it may go away during a garbage collection
     cycle and cause a nasty bug when the C code tries to use it.
@@ -272,10 +272,10 @@ pure nothrow unittest
 alias CaseSensitive = Flag!"caseSensitive";
 
 /++
-    Returns the index of the first occurrence of $(D c) in $(D s). If $(D c)
-    is not found, then $(D -1) is returned.
+    Returns the index of the first occurrence of `c` in `s`. If `c`
+    is not found, then `-1` is returned.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t indexOf(Char)(in Char[] s, in dchar c,
         in CaseSensitive cs = CaseSensitive.yes) @safe pure
@@ -371,14 +371,14 @@ ptrdiff_t indexOf(Char)(in Char[] s, in dchar c,
 }
 
 /++
-    Returns the index of the first occurrence of $(D c) in $(D s) with respect
-    to the start index $(D startIdx). If $(D c) is not found, then $(D -1) is
-    returned. If $(D c) is found the value of the returned index is at least
-    $(D startIdx). $(D startIdx) represents a codeunit index in $(D s). If the
-    sequence starting at $(D startIdx) does not represent a well formed codepoint,
+    Returns the index of the first occurrence of `c` in `s` with respect
+    to the start index `startIdx`. If `c` is not found, then `-1` is
+    returned. If `c` is found the value of the returned index is at least
+    `startIdx`. `startIdx` represents a codeunit index in `s`. If the
+    sequence starting at `startIdx` does not represent a well formed codepoint,
     then a $(XREF utf,UTFException) may be thrown.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t indexOf(Char)(const(Char)[] s, in dchar c, in size_t startIdx,
         in CaseSensitive cs = CaseSensitive.yes) @safe pure
@@ -437,10 +437,10 @@ ptrdiff_t indexOf(Char)(const(Char)[] s, in dchar c, in size_t startIdx,
 }
 
 /++
-    Returns the index of the first occurrence of $(D sub) in $(D s). If $(D sub)
-    is not found, then $(D -1) is returned.
+    Returns the index of the first occurrence of `sub` in `s`. If `sub`
+    is not found, then `-1` is returned.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
         in CaseSensitive cs = CaseSensitive.yes) @trusted
@@ -516,14 +516,14 @@ ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
 }
 
 /++
-    Returns the index of the first occurrence of $(D sub) in $(D s) with
-    respect to the start index $(D startIdx). If $(D sub) is not found, then
-    $(D -1) is returned. If $(D sub) is found the value of the returned index
-    is at least $(D startIdx). $(D startIdx) represents a codeunit index in
-    $(D s). If the sequence starting at $(D startIdx) does not represent a well
+    Returns the index of the first occurrence of `sub` in `s` with
+    respect to the start index `startIdx`. If `sub` is not found, then
+    `-1` is returned. If `sub` is found the value of the returned index
+    is at least `startIdx`. `startIdx` represents a codeunit index in
+    `s`. If the sequence starting at `startIdx` does not represent a well
     formed codepoint, then a $(XREF utf,UTFException) may be thrown.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
         in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes)
@@ -600,10 +600,10 @@ ptrdiff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
 }
 
 /++
-    Returns the index of the last occurrence of $(D c) in $(D s). If $(D c)
-    is not found, then $(D -1) is returned.
+    Returns the index of the last occurrence of `c` in `s`. If `c`
+    is not found, then `-1` is returned.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c,
         in CaseSensitive cs = CaseSensitive.yes) @safe pure
@@ -708,14 +708,14 @@ ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c,
 }
 
 /++
-    Returns the index of the last occurrence of $(D c) in $(D s). If $(D c) is
-    not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in
-    the following way $(D s[0 .. startIdx]). $(D startIdx) represents a
-    codeunit index in $(D s). If the sequence ending at $(D startIdx) does not
+    Returns the index of the last occurrence of `c` in `s`. If `c` is
+    not found, then `-1` is returned. The `startIdx` slices `s` in
+    the following way $(D s[0 .. startIdx]). `startIdx` represents a
+    codeunit index in `s`. If the sequence ending at `startIdx` does not
     represent a well formed codepoint, then a $(XREF utf,UTFException) may be
     thrown.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c, in size_t startIdx,
         in CaseSensitive cs = CaseSensitive.yes) @safe pure
@@ -764,10 +764,10 @@ ptrdiff_t lastIndexOf(Char)(const(Char)[] s, in dchar c, in size_t startIdx,
 }
 
 /++
-    Returns the index of the last occurrence of $(D sub) in $(D s). If $(D sub)
-    is not found, then $(D -1) is returned.
+    Returns the index of the last occurrence of `sub` in `s`. If `sub`
+    is not found, then `-1` is returned.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
         in CaseSensitive cs = CaseSensitive.yes) @safe pure
@@ -925,14 +925,14 @@ ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
 }
 
 /++
-    Returns the index of the last occurrence of $(D sub) in $(D s). If $(D sub)
-    is not found, then $(D -1) is returned. The $(D startIdx) slices $(D s) in
-    the following way $(D s[0 .. startIdx]). $(D startIdx) represents a
-    codeunit index in $(D s). If the sequence ending at $(D startIdx) does not
+    Returns the index of the last occurrence of `sub` in `s`. If `sub`
+    is not found, then `-1` is returned. The `startIdx` slices `s` in
+    the following way $(D s[0 .. startIdx]). `startIdx` represents a
+    codeunit index in `s`. If the sequence ending at `startIdx` does not
     represent a well formed codepoint, then a $(XREF utf,UTFException) may be
     thrown.
 
-    $(D cs) indicates whether the comparisons are case sensitive.
+    `cs` indicates whether the comparisons are case sensitive.
   +/
 ptrdiff_t lastIndexOf(Char1, Char2)(const(Char1)[] s, const(Char2)[] sub,
         in size_t startIdx, in CaseSensitive cs = CaseSensitive.yes) @safe pure
@@ -1115,8 +1115,8 @@ private ptrdiff_t indexOfAnyNeitherImpl(bool forward, bool any, Char, Char2)(
 
 /**
     Returns the index of the first occurence of any of the elements in $(D
-    needles) in $(D haystack). If no element of $(D needles) is found,
-    then $(D -1) is returned.
+    needles) in `haystack`. If no element of `needles` is found,
+    then `-1` is returned.
 
     Params:
     haystack = String to search for needles in.
@@ -1183,10 +1183,10 @@ ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles,
 
 /**
     Returns the index of the first occurence of any of the elements in $(D
-    needles) in $(D haystack). If no element of $(D needles) is found,
-    then $(D -1) is returned. The $(D startIdx) slices $(D s) in the following
-    way $(D haystack[startIdx .. $]). $(D startIdx) represents a codeunit
-    index in $(D haystack). If the sequence ending at $(D startIdx) does not
+    needles) in `haystack`. If no element of `needles` is found,
+    then `-1` is returned. The `startIdx` slices `s` in the following
+    way $(D haystack[startIdx .. $]). `startIdx` represents a codeunit
+    index in `haystack`. If the sequence ending at `startIdx` does not
     represent a well formed codepoint, then a $(XREF utf,UTFException) may be
     thrown.
 
@@ -1195,7 +1195,7 @@ ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles,
     needles = Strings to search for in haystack.
         startIdx = slices haystack like this $(D haystack[startIdx .. $]). If
         the startIdx is greater equal the length of haystack the functions
-        returns $(D -1).
+        returns `-1`.
         cs = Indicates whether the comparisons are case sensitive.
 */
 ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles,
@@ -1276,8 +1276,8 @@ ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles,
 
 /**
     Returns the index of the last occurence of any of the elements in $(D
-    needles) in $(D haystack). If no element of $(D needles) is found,
-    then $(D -1) is returned.
+    needles) in `haystack`. If no element of `needles` is found,
+    then `-1` is returned.
 
     Params:
     haystack = String to search for needles in.
@@ -1358,10 +1358,10 @@ ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack,
 
 /**
     Returns the index of the last occurence of any of the elements in $(D
-    needles) in $(D haystack). If no element of $(D needles) is found,
-    then $(D -1) is returned. The $(D stopIdx) slices $(D s) in the following
-    way $(D s[0 .. stopIdx]). $(D stopIdx) represents a codeunit index in
-    $(D s). If the sequence ending at $(D startIdx) does not represent a well
+    needles) in `haystack`. If no element of `needles` is found,
+    then `-1` is returned. The `stopIdx` slices `s` in the following
+    way $(D s[0 .. stopIdx]). `stopIdx` represents a codeunit index in
+    `s`. If the sequence ending at `startIdx` does not represent a well
     formed codepoint, then a $(XREF utf,UTFException) may be thrown.
 
     Params:
@@ -1369,7 +1369,7 @@ ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack,
     needles = Strings to search for in haystack.
         stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]). If
         the stopIdx is greater equal the length of haystack the functions
-        returns $(D -1).
+        returns `-1`.
         cs = Indicates whether the comparisons are case sensitive.
 */
 ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack,
@@ -1453,8 +1453,8 @@ ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack,
 
 /**
     Returns the index of the first occurence of any character not an elements
-    in $(D needles) in $(D haystack). If all element of $(D haystack) are
-    element of $(D needles) $(D -1) is returned.
+    in `needles` in `haystack`. If all element of `haystack` are
+    element of `needles` `-1` is returned.
 
     Params:
     haystack = String to search for needles in.
@@ -1525,15 +1525,15 @@ ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack,
 
 /**
     Returns the index of the first occurence of any character not an elements
-    in $(D needles) in $(D haystack). If all element of $(D haystack) are
-    element of $(D needles) $(D -1) is returned.
+    in `needles` in `haystack`. If all element of `haystack` are
+    element of `needles` `-1` is returned.
 
     Params:
     haystack = String to search for needles in.
     needles = Strings to search for in haystack.
         startIdx = slices haystack like this $(D haystack[startIdx .. $]). If
         the startIdx is greater equal the length of haystack the functions
-        returns $(D -1).
+        returns `-1`.
         cs = Indicates whether the comparisons are case sensitive.
 */
 ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack,
@@ -1609,8 +1609,8 @@ ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack,
 
 /**
     Returns the last index of the first occurence of any character that is not
-    an elements in $(D needles) in $(D haystack). If all element of
-    $(D haystack) are element of $(D needles) $(D -1) is returned.
+    an elements in `needles` in `haystack`. If all element of
+    `haystack` are element of `needles` `-1` is returned.
 
     Params:
     haystack = String to search for needles in.
@@ -1681,15 +1681,15 @@ ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack,
 
 /**
     Returns the last index of the first occurence of any character that is not
-    an elements in $(D needles) in $(D haystack). If all element of
-    $(D haystack) are element of $(D needles) $(D -1) is returned.
+    an elements in `needles` in `haystack`. If all element of
+    `haystack` are element of `needles` `-1` is returned.
 
     Params:
     haystack = String to search for needles in.
     needles = Strings to search for in haystack.
         stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]) If
         the stopIdx is greater equal the length of haystack the functions
-        returns $(D -1).
+        returns `-1`.
         cs = Indicates whether the comparisons are case sensitive.
 */
 ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack,
@@ -1762,8 +1762,8 @@ ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack,
 
 /**
  * Returns the representation of a string, which has the same type
- * as the string except the character type is replaced by $(D ubyte),
- * $(D ushort), or $(D uint) depending on the character width.
+ * as the string except the character type is replaced by `ubyte`,
+ * `ushort`, or `uint` depending on the character width.
  */
 auto representation(Char)(Char[] s) @safe pure nothrow @nogc
     if (isSomeChar!Char)
@@ -1813,7 +1813,7 @@ auto representation(Char)(Char[] s) @safe pure nothrow @nogc
 
 
 /++
-    Capitalize the first character of $(D s) and convert the rest of $(D s)
+    Capitalize the first character of `s` and convert the rest of `s`
     to lowercase.
  +/
 S capitalize(S)(S s) @trusted pure
@@ -1893,9 +1893,9 @@ S capitalize(S)(S s) @trusted pure
 }
 
 /++
-    Split $(D s) into an array of lines using $(D '\r'), $(D '\n'),
-    $(D "\r\n"), $(XREF uni, lineSep), and $(XREF uni, paraSep) as delimiters.
-    If $(D keepTerm) is set to $(D KeepTerminator.yes), then the delimiter
+    Split `s` into an array of lines using `'\r'`, `'\n'`,
+    `"\r\n"`, $(XREF uni, lineSep), and $(XREF uni, paraSep) as delimiters.
+    If `keepTerm` is set to `KeepTerminator.yes`, then the delimiter
     is included in the strings returned.
   +/
 alias KeepTerminator = Flag!"keepTerminator";
@@ -1995,9 +1995,9 @@ S[] splitLines(S)(S s, in KeepTerminator keepTerm = KeepTerminator.no) @safe pur
 /++
     Strips leading whitespace (as defined by $(XREF uni, isWhite)).
 
-    Returns: $(D str) stripped of leading whitespace.
+    Returns: `str` stripped of leading whitespace.
 
-    Postconditions: $(D str) and the returned value
+    Postconditions: `str` and the returned value
     will share the same tail (see $(XREF array, sameTail)).
   +/
 C[] stripLeft(C)(C[] str) @safe pure @nogc
@@ -2032,9 +2032,9 @@ C[] stripLeft(C)(C[] str) @safe pure @nogc
 /++
     Strips trailing whitespace (as defined by $(XREF uni, isWhite)).
 
-    Returns: $(D str) stripped of trailing whitespace.
+    Returns: `str` stripped of trailing whitespace.
 
-    Postconditions: $(D str) and the returned value
+    Postconditions: `str` and the returned value
     will share the same head (see $(XREF array, sameHead)).
   +/
 C[] stripRight(C)(C[] str) @safe pure @nogc
@@ -2071,7 +2071,7 @@ C[] stripRight(C)(C[] str) @safe pure @nogc
     Strips both leading and trailing whitespace (as defined by
     $(XREF uni, isWhite)).
 
-    Returns: $(D str) stripped of trailing whitespace.
+    Returns: `str` stripped of trailing whitespace.
   +/
 C[] strip(C)(C[] str) @safe pure
     if (isSomeChar!C)
@@ -2146,13 +2146,13 @@ C[] strip(C)(C[] str) @safe pure
 
 
 /++
-    If $(D str) ends with $(D delimiter), then $(D str) is returned without
-    $(D delimiter) on its end. If it $(D str) does $(I not) end with
-    $(D delimiter), then it is returned unchanged.
+    If `str` ends with `delimiter`, then `str` is returned without
+    `delimiter` on its end. If it `str` does $(I not) end with
+    `delimiter`, then it is returned unchanged.
 
-    If no $(D delimiter) is given, then one trailing  $(D '\r'), $(D '\n'),
-    $(D "\r\n"), $(XREF uni, lineSep), or $(XREF uni, paraSep) is removed from
-    the end of $(D str). If $(D str) does not end with any of those characters,
+    If no `delimiter` is given, then one trailing  `'\r'`, `'\n'`,
+    `"\r\n"`, $(XREF uni, lineSep), or $(XREF uni, paraSep) is removed from
+    the end of `str`. If `str` does not end with any of those characters,
     then it is returned unchanged.
   +/
 C[] chomp(C)(C[] str) @safe pure nothrow @nogc
@@ -2295,9 +2295,9 @@ unittest
 
 
 /++
-    If $(D str) starts with $(D delimiter), then the part of $(D str) following
-    $(D delimiter) is returned. If it $(D str) does $(I not) start with
-    $(D delimiter), then it is returned unchanged.
+    If `str` starts with `delimiter`, then the part of `str` following
+    `delimiter` is returned. If it `str` does $(I not) start with
+    `delimiter`, then it is returned unchanged.
  +/
 C1[] chompPrefix(C1, C2)(C1[] str, C2[] delimiter) @safe pure
     if (isSomeChar!C1 && isSomeChar!C2)
@@ -2358,8 +2358,8 @@ C1[] chompPrefix(C1, C2)(C1[] str, C2[] delimiter) @safe pure
 
 
 /++
-    Returns $(D str) without its last character, if there is one. If $(D str)
-    ends with $(D "\r\n"), then both are removed. If $(D str) is empty, then
+    Returns `str` without its last character, if there is one. If `str`
+    ends with `"\r\n"`, then both are removed. If `str` is empty, then
     then it is returned unchanged.
  +/
 S chop(S)(S str) @safe pure
@@ -2413,9 +2413,9 @@ unittest
 
 
 /++
-    Left justify $(D s) in a field $(D width) characters wide. $(D fillChar)
+    Left justify `s` in a field `width` characters wide. `fillChar`
     is the character that will be used to fill up the space in the field that
-    $(D s) doesn't fill.
+    `s` doesn't fill.
   +/
 S leftJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
     if (isSomeString!S)
@@ -2451,9 +2451,9 @@ S leftJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
 
 
 /++
-    Right justify $(D s) in a field $(D width) characters wide. $(D fillChar)
+    Right justify `s` in a field `width` characters wide. `fillChar`
     is the character that will be used to fill up the space in the field that
-    $(D s) doesn't fill.
+    `s` doesn't fill.
   +/
 S rightJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
     if (isSomeString!S)
@@ -2489,9 +2489,9 @@ S rightJustify(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
 
 
 /++
-    Center $(D s) in a field $(D width) characters wide. $(D fillChar)
+    Center `s` in a field `width` characters wide. `fillChar`
     is the character that will be used to fill up the space in the field that
-    $(D s) doesn't fill.
+    `s` doesn't fill.
   +/
 S center(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
     if (isSomeString!S)
@@ -2567,8 +2567,8 @@ S center(S)(S s, size_t width, dchar fillChar = ' ') @trusted pure
 
 
 /++
-    Replace each tab character in $(D s) with the number of spaces necessary
-    to align the following character at the next tab stop where $(D tabSize)
+    Replace each tab character in `s` with the number of spaces necessary
+    to align the following character at the next tab stop where `tabSize`
     is the distance between tab stops.
   +/
 S detab(S)(S s, size_t tabSize = 8) @trusted pure
@@ -2657,12 +2657,12 @@ S detab(S)(S s, size_t tabSize = 8) @trusted pure
 }
 
 /++
-    Replaces spaces in $(D s) with the optimal number of tabs.
+    Replaces spaces in `s` with the optimal number of tabs.
     All spaces and tabs at the end of a line are removed.
 
     Params:
         s       = String to convert.
-        tabSize = Tab columns are $(D tabSize) spaces apart.
+        tabSize = Tab columns are `tabSize` spaces apart.
  +/
 S entab(S)(S s, size_t tabSize = 8) @trusted pure
     if (isSomeString!S)
@@ -2808,11 +2808,11 @@ S entab(S)(S s, size_t tabSize = 8) @trusted pure
 
 
 /++
-    Replaces the characters in $(D str) which are keys in $(D transTable) with
-    their corresponding values in $(D transTable). $(D transTable) is an AA
-    where its keys are $(D dchar) and its values are either $(D dchar) or some
-    type of string. Also, if $(D toRemove) is given, the characters in it are
-    removed from $(D str) prior to translation. $(D str) itself is unaltered.
+    Replaces the characters in `str` which are keys in `transTable` with
+    their corresponding values in `transTable`. `transTable` is an AA
+    where its keys are `dchar` and its values are either `dchar` or some
+    type of string. Also, if `toRemove` is given, the characters in it are
+    removed from `str` prior to translation. `str` itself is unaltered.
     A copy with the changes is returned.
 
     See_Also:
@@ -2971,7 +2971,7 @@ C1[] translate(C1, S, C2 = immutable char)(C1[] str,
 }
 
 /++
-    This is an overload of $(D translate) which takes an existing buffer to write the contents to.
+    This is an overload of `translate` which takes an existing buffer to write the contents to.
 
     Params:
         str        = The original string.
@@ -3066,22 +3066,22 @@ private void translateImpl(C1, T, C2, Buffer)(C1[] str,
     cases where Unicode processing is not necessary.
 
     Unlike the other overloads of $(LREF _translate), this one does not take
-    an AA. Rather, it takes a $(D string) generated by $(LREF makeTrans).
+    an AA. Rather, it takes a `string` generated by $(LREF makeTrans).
 
-    The array generated by $(D makeTrans) is $(D 256) elements long such that
+    The array generated by `makeTrans` is `256` elements long such that
     the index is equal to the ASCII character being replaced and the value is
     equal to the character that it's being replaced with. Note that translate
     does not decode any of the characters, so you can actually pass it Extended
-    ASCII characters if you want to (ASCII only actually uses $(D 128)
+    ASCII characters if you want to (ASCII only actually uses `128`
     characters), but be warned that Extended ASCII characters are not valid
-    Unicode and therefore will result in a $(D UTFException) being thrown from
+    Unicode and therefore will result in a `UTFException` being thrown from
     most other Phobos functions.
 
     Also, because no decoding occurs, it is possible to use this overload to
     translate ASCII characters within a proper UTF-8 string without altering the
     other, non-ASCII characters. It's replacing any code unit greater than
-    $(D 127) with another code unit or replacing any code unit with another code
-    unit greater than $(D 127) which will cause UTF validation issues.
+    `127` with another code unit or replacing any code unit with another code
+    unit greater than `127` which will cause UTF validation issues.
 
     See_Also:
         $(LREF tr)
@@ -3197,7 +3197,7 @@ body
 }
 
 /++
-    This is an $(I $(RED ASCII-only)) overload of $(D translate) which takes an existing buffer to write the contents to.
+    This is an $(I $(RED ASCII-only)) overload of `translate` which takes an existing buffer to write the contents to.
 
     Params:
         str        = The original string.
@@ -3642,10 +3642,10 @@ S succ(S)(S s) @safe pure if (isSomeString!S)
 
 
 /++
-    Replaces the characters in $(D str) which are in $(D from) with the
-    the corresponding characters in $(D to) and returns the resulting string.
+    Replaces the characters in `str` which are in `from` with the
+    the corresponding characters in `to` and returns the resulting string.
 
-    $(D tr) is based on
+    `tr` is based on
     $(WEB pubs.opengroup.org/onlinepubs/9699919799/utilities/_tr.html, Posix's tr),
     though it doesn't do everything that the Posix utility does.
 
@@ -3658,26 +3658,26 @@ S succ(S)(S s) @safe pure if (isSomeString!S)
     Modifiers:
         $(BOOKTABLE,
         $(TR $(TD Modifier) $(TD Description))
-        $(TR $(TD $(D 'c')) $(TD Complement the list of characters in $(D from)))
-        $(TR $(TD $(D 'd')) $(TD Removes matching characters with no corresponding
-                              replacement in $(D to)))
-        $(TR $(TD $(D 's')) $(TD Removes adjacent duplicates in the replaced
+        $(TR $(TD `'c'`) $(TD Complement the list of characters in `from`))
+        $(TR $(TD `'d'`) $(TD Removes matching characters with no corresponding
+                              replacement in `to`))
+        $(TR $(TD `'s'`) $(TD Removes adjacent duplicates in the replaced
                               characters))
         )
 
-    If the modifier $(D 'd') is present, then the number of characters in
-    $(D to) may be only $(D 0) or $(D 1).
+    If the modifier `'d'` is present, then the number of characters in
+    `to` may be only `0` or `1`.
 
-    If the modifier $(D 'd') is $(I not) present, and $(D to) is empty, then
-    $(D to) is taken to be the same as $(D from).
+    If the modifier `'d'` is $(I not) present, and `to` is empty, then
+    `to` is taken to be the same as `from`.
 
-    If the modifier $(D 'd') is $(I not) present, and $(D to) is shorter than
-    $(D from), then $(D to) is extended by replicating the last character in
-    $(D to).
+    If the modifier `'d'` is $(I not) present, and `to` is shorter than
+    `from`, then `to` is extended by replicating the last character in
+    `to`.
 
-    Both $(D from) and $(D to) may contain ranges using the $(D '-') character
-    (e.g. $(D "a-d") is synonymous with $(D "abcd").) Neither accept a leading
-    $(D '^') as meaning the complement of the string (use the $(D 'c') modifier
+    Both `from` and `to` may contain ranges using the `'-'` character
+    (e.g. `"a-d"` is synonymous with `"abcd"`.) Neither accept a leading
+    `'^'` as meaning the complement of the string (use the `'c'` modifier
     for that).
   +/
 C1[] tr(C1, C2, C3, C4 = immutable char)
@@ -3876,7 +3876,7 @@ unittest
  *
  * [in] bool bAllowSep
  * False by default, but when set to true it will accept the
- * separator characters $(D ',') and $(D '__') within the string, but these
+ * separator characters `','` and $(D '__') within the string, but these
  * characters should be stripped from the string before using any
  * of the conversion functions like toInt(), toFloat(), and etc
  * else an error will occur.
@@ -4704,11 +4704,11 @@ void main() {
     });
 }
 
-/** Assume the given array of integers $(D arr) is a well-formed UTF string and
+/** Assume the given array of integers `arr` is a well-formed UTF string and
 return it typed as a UTF string.
 
-$(D ubyte) becomes $(D char), $(D ushort) becomes $(D wchar) and $(D uint)
-becomes $(D dchar). Type qualifiers are preserved.
+`ubyte` becomes `char`, `ushort` becomes `wchar` and `uint`
+becomes `dchar`. Type qualifiers are preserved.
 
 See_Also: $(LREF representation)
 */
diff --git a/std/system.d b/std/system.d
index d4b47fe87ab..d8b167257d0 100644
--- a/std/system.d
+++ b/std/system.d
@@ -21,8 +21,8 @@ immutable
         Note:
             This is for cases where you need a value representing the OS at
             runtime. If you're doing something which should compile differently
-            on different OSes, then please use $(D version(Windows)),
-            $(D version(linux)), etc.
+            on different OSes, then please use `version(Windows)`,
+            `version(linux)`, etc.
 
         See_Also:
             Predefined Versions
@@ -56,8 +56,8 @@ immutable
             This is intended for cases where you need to deal with endianness at
             runtime. If you're doing something which should compile differently
             depending on whether you're compiling on a big endian or little
-            endian machine, then please use $(D version(BigEndian)) and
-            $(D version(LittleEndian)).
+            endian machine, then please use `version(BigEndian)` and
+            `version(LittleEndian)`.
 
         See_Also:
             Predefined Versions
diff --git a/std/traits.d b/std/traits.d
index 7f85f752a0c..09053da4811 100644
--- a/std/traits.d
+++ b/std/traits.d
@@ -134,7 +134,7 @@
  * Copyright: Copyright Digital Mars 2005 - 2009.
  * License:   $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
  * Authors:   $(WEB digitalmars.com, Walter Bright),
- *            Tomasz Stachowiak ($(D isExpressionTuple)),
+ *            Tomasz Stachowiak (`isExpressionTuple`),
  *            $(WEB erdani.org, Andrei Alexandrescu),
  *            Shin Fujishiro,
  *            $(WEB octarineparrot.com, Robert Clipsham),
@@ -804,7 +804,7 @@ unittest
  * Get the type of the return value from a function,
  * a pointer to function, a delegate, a struct
  * with an opCall, a pointer to a struct with an opCall,
- * or a class with an $(D opCall). Please note that $(D_KEYWORD ref)
+ * or a class with an `opCall`. Please note that $(D_KEYWORD ref)
  * is not part of a type, but the attribute of the function
  * (see template $(LREF functionAttributes)).
  * Example:
@@ -863,8 +863,8 @@ unittest
 
 /***
 Get, as a tuple, the types of the parameters to a function, a pointer
-to function, a delegate, a struct with an $(D opCall), a pointer to a
-struct with an $(D opCall), or a class with an $(D opCall).
+to function, a delegate, a struct with an `opCall`, a pointer to a
+struct with an `opCall`, or a class with an `opCall`.
 
 Example:
 ---
@@ -908,7 +908,7 @@ unittest
 }
 
 /**
-Returns the number of arguments of function $(D func).
+Returns the number of arguments of function `func`.
 arity is undefined for variadic functions.
 
 Example:
@@ -936,7 +936,7 @@ unittest {
 
 /**
 Returns a tuple consisting of the storage classes of the parameters of a
-function $(D func).
+function `func`.
 
 Example:
 --------------------
@@ -1134,7 +1134,7 @@ unittest
 
 /**
 Get, as a tuple, the default value of the parameters to a function symbol.
-If a parameter doesn't have the default value, $(D void) is returned instead.
+If a parameter doesn't have the default value, `void` is returned instead.
  */
 template ParameterDefaultValueTuple(func...)
     if (func.length == 1 && isCallable!func)
@@ -1228,7 +1228,7 @@ unittest
 
 
 /**
-Returns the attributes attached to a function $(D func).
+Returns the attributes attached to a function `func`.
  */
 enum FunctionAttribute : uint
 {
@@ -1416,7 +1416,7 @@ private FunctionAttribute extractAttribFlags(Attribs...)()
 
 
 /**
-$(D true) if $(D func) is $(D @safe) or $(D @trusted).
+`true` if `func` is `@safe` or `@trusted`.
 
 Example:
 --------------------
@@ -1506,7 +1506,7 @@ unittest
 
 
 /**
-$(D true) if $(D func) is $(D @system).
+`true` if `func` is `@system`.
 
 Example:
 --------------------
@@ -1598,7 +1598,7 @@ also badly broken prior to 2.060 (bug# 8362), so any code which uses it
 probably needs to be changed anyway. Please use $(D allSatisfy(isSafe, ...))
 instead. This will be removed in June 2015.)
 
-$(D true) all functions are $(D isSafe).
+`true` all functions are `isSafe`.
 
 Example:
 --------------------
@@ -1763,11 +1763,11 @@ unittest
 
 
 /**
-Get the function type from a callable object $(D func).
+Get the function type from a callable object `func`.
 
-Using builtin $(D typeof) on a property function yields the types of the
+Using builtin `typeof` on a property function yields the types of the
 property value, not of the property function itself.  Still,
-$(D FunctionTypeOf) is able to obtain function types of properties.
+`FunctionTypeOf` is able to obtain function types of properties.
 --------------------
 class C
 {
@@ -2032,8 +2032,8 @@ unittest
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
 
 /**
-Determines whether $(D T) has its own context pointer.
-$(D T) must be either $(D class), $(D struct), or $(D union).
+Determines whether `T` has its own context pointer.
+`T` must be either `class`, `struct`, or `union`.
 */
 template isNested(T)
     if(is(T == class) || is(T == struct) || is(T == union))
@@ -2053,7 +2053,7 @@ unittest
 }
 
 /**
-Determines whether $(D T) or any of its representation types
+Determines whether `T` or any of its representation types
 have a context pointer.
 */
 template hasNested(T)
@@ -2136,8 +2136,8 @@ unittest
  * This consists of the fields that take up memory space,
  * excluding the hidden fields like the virtual function
  * table pointer or a context pointer for nested types.
- * If $(D T) isn't a struct, class, or union returns typetuple
- * with one element $(D T).
+ * If `T` isn't a struct, class, or union returns typetuple
+ * with one element `T`.
  */
 template FieldTypeTuple(T)
 {
@@ -2186,7 +2186,7 @@ private enum NameOf(alias T) = T.stringof;
  * Get as an expression tuple the names of the fields of a struct, class, or
  * union. This consists of the fields that take up memory space, excluding the
  * hidden fields like the virtual function table pointer or a context pointer
- * for nested types. If $(D T) isn't a struct, class, or union returns an
+ * for nested types. If `T` isn't a struct, class, or union returns an
  * expression tuple with an empty string.
  */
 template FieldNameTuple(T)
@@ -2453,7 +2453,7 @@ RepresentationOffsets
 // }
 
 /*
-Statically evaluates to $(D true) if and only if $(D T)'s
+Statically evaluates to `true` if and only if `T`'s
 representation contains at least one field of pointer or array type.
 Members of class types are not considered raw pointers. Pointers to
 immutable objects are not considered raw aliasing.
@@ -2563,7 +2563,7 @@ unittest
 }
 
 /*
-Statically evaluates to $(D true) if and only if $(D T)'s
+Statically evaluates to `true` if and only if `T`'s
 representation contains at least one non-shared field of pointer or
 array type.  Members of class types are not considered raw pointers.
 Pointers to immutable objects are not considered raw aliasing.
@@ -2760,7 +2760,7 @@ unittest
 }
 
 /*
-Statically evaluates to $(D true) if and only if $(D T)'s
+Statically evaluates to `true` if and only if `T`'s
 representation includes at least one non-immutable object reference.
 */
 
@@ -2783,7 +2783,7 @@ private template hasObjects(T...)
 }
 
 /*
-Statically evaluates to $(D true) if and only if $(D T)'s
+Statically evaluates to `true` if and only if `T`'s
 representation includes at least one non-immutable non-shared object
 reference.
 */
@@ -2807,10 +2807,10 @@ private template hasUnsharedObjects(T...)
 }
 
 /**
-Returns $(D true) if and only if $(D T)'s representation includes at
-least one of the following: $(OL $(LI a raw pointer $(D U*) and $(D U)
-is not immutable;) $(LI an array $(D U[]) and $(D U) is not
-immutable;) $(LI a reference to a class or interface type $(D C) and $(D C) is
+Returns `true` if and only if `T`'s representation includes at
+least one of the following: $(OL $(LI a raw pointer `U*` and `U`
+is not immutable;) $(LI an array `U[]` and `U` is not
+immutable;) $(LI a reference to a class or interface type `C` and `C` is
 not immutable.) $(LI an associative array that is not immutable.)
 $(LI a delegate.))
 */
@@ -2909,9 +2909,9 @@ unittest
     static assert(!hasAliasing!S14);
 }
 /**
-Returns $(D true) if and only if $(D T)'s representation includes at
-least one of the following: $(OL $(LI a raw pointer $(D U*);) $(LI an
-array $(D U[]);) $(LI a reference to a class type $(D C).)
+Returns `true` if and only if `T`'s representation includes at
+least one of the following: $(OL $(LI a raw pointer `U*`;) $(LI an
+array `U[]`;) $(LI a reference to a class type `C`.)
 $(LI an associative array.) $(LI a delegate.))
  */
 template hasIndirections(T)
@@ -3012,11 +3012,11 @@ unittest //12000
 }
 
 /**
-Returns $(D true) if and only if $(D T)'s representation includes at
-least one of the following: $(OL $(LI a raw pointer $(D U*) and $(D U)
-is not immutable or shared;) $(LI an array $(D U[]) and $(D U) is not
-immutable or shared;) $(LI a reference to a class type $(D C) and
-$(D C) is not immutable or shared.) $(LI an associative array that is not
+Returns `true` if and only if `T`'s representation includes at
+least one of the following: $(OL $(LI a raw pointer `U*` and `U`
+is not immutable or shared;) $(LI an array `U[]` and `U` is not
+immutable or shared;) $(LI a reference to a class type `C` and
+`C` is not immutable or shared.) $(LI an associative array that is not
 immutable or shared.) $(LI a delegate that is not shared.))
 */
 
@@ -3180,9 +3180,9 @@ unittest
 }
 
 /**
- True if $(D S) or any type embedded directly in the representation of $(D S)
+ True if `S` or any type embedded directly in the representation of `S`
  defines an elaborate copy constructor. Elaborate copy constructors are
- introduced by defining $(D this(this)) for a $(D struct).
+ introduced by defining `this(this)` for a `struct`.
 
  Classes and unions never have elaborate copy constructors.
  */
@@ -3227,12 +3227,12 @@ unittest
 }
 
 /**
-   True if $(D S) or any type directly embedded in the representation of $(D S)
+   True if `S` or any type directly embedded in the representation of `S`
    defines an elaborate assignment. Elaborate assignments are introduced by
    defining $(D opAssign(typeof(this))) or $(D opAssign(ref typeof(this)))
-   for a $(D struct) or when there is a compiler-generated $(D opAssign).
+   for a `struct` or when there is a compiler-generated `opAssign`.
 
-   A type $(D S) gets compiler-generated $(D opAssign) in case it has
+   A type `S` gets compiler-generated `opAssign` in case it has
    an elaborate copy constructor or elaborate destructor.
 
    Classes and unions never have elaborate assignments.
@@ -3314,13 +3314,13 @@ unittest
 }
 
 /**
-   True if $(D S) or any type directly embedded in the representation
-   of $(D S) defines an elaborate destructor. Elaborate destructors
-   are introduced by defining $(D ~this()) for a $(D
+   True if `S` or any type directly embedded in the representation
+   of `S` defines an elaborate destructor. Elaborate destructors
+   are introduced by defining `~this()` for a $(D
    struct).
 
    Classes and unions never have elaborate destructors, even
-   though classes may define $(D ~this()).
+   though classes may define `~this()`.
  */
 template hasElaborateDestructor(S)
 {
@@ -3365,8 +3365,8 @@ unittest
 alias Identity(alias A) = A;
 
 /**
-   Yields $(D true) if and only if $(D T) is an aggregate that defines
-   a symbol called $(D name).
+   Yields `true` if and only if `T` is an aggregate that defines
+   a symbol called `name`.
  */
 template hasMember(T, string name)
 {
@@ -3432,11 +3432,11 @@ unittest
 Retrieves the members of an enumerated type $(D enum E).
 
 Params:
- E = An enumerated type. $(D E) may have duplicated values.
+ E = An enumerated type. `E` may have duplicated values.
 
 Returns:
- Static tuple composed of the members of the enumerated type $(D E).
- The members are arranged in the same order as declared in $(D E).
+ Static tuple composed of the members of the enumerated type `E`.
+ The members are arranged in the same order as declared in `E`.
 
 Note:
  An enum can have multiple members which have the same value. If you want
@@ -3445,7 +3445,7 @@ Note:
  generating duplicate switch cases.
 
 Note:
- Returned values are strictly typed with $(D E). Thus, the following code
+ Returned values are strictly typed with `E`. Thus, the following code
  does not work without the explicit cast:
 --------------------
 enum E : int { a, b, c }
@@ -3467,8 +3467,8 @@ auto sqrts = [ EnumMembers!Sqrts ];
 assert(sqrts == [ Sqrts.one, Sqrts.two, Sqrts.three ]);
 --------------------
 
- A generic function $(D rank(v)) in the following example uses this
- template for finding a member $(D e) in an enumerated type $(D E).
+ A generic function `rank(v)` in the following example uses this
+ template for finding a member `e` in an enumerated type `E`.
 --------------------
 // Returns i if e is the i-th enumerator of E.
 size_t rank(E)(E e)
@@ -3822,8 +3822,8 @@ unittest
 
 
 /**
-Returns a tuple of non-static functions with the name $(D name) declared in the
-class or interface $(D C).  Covariant duplicates are shrunk into the most
+Returns a tuple of non-static functions with the name `name` declared in the
+class or interface `C`.  Covariant duplicates are shrunk into the most
 derived one.
 
 Example:
@@ -3975,7 +3975,7 @@ unittest
 
 
 /**
-Returns an alias to the template that $(D T) is an instance of.
+Returns an alias to the template that `T` is an instance of.
 
 Example:
 --------------------
@@ -4018,7 +4018,7 @@ unittest
 
 
 /**
-Returns a $(D TypeTuple) of the template arguments used to instantiate $(D T).
+Returns a `TypeTuple` of the template arguments used to instantiate `T`.
 
 Example:
 --------------------
@@ -4224,7 +4224,7 @@ unittest
 }
 
 /**
-Is $(D From) implicitly convertible to $(D To)?
+Is `From` implicitly convertible to `To`?
  */
 template isImplicitlyConvertible(From, To)
 {
@@ -4256,12 +4256,12 @@ unittest
 }
 
 /**
-Returns $(D true) iff a value of type $(D Rhs) can be assigned to a variable of
-type $(D Lhs).
+Returns `true` iff a value of type `Rhs` can be assigned to a variable of
+type `Lhs`.
 
-$(D isAssignable) returns whether both an lvalue and rvalue can be assigned.
+`isAssignable` returns whether both an lvalue and rvalue can be assigned.
 
-If you omit $(D Rhs), $(D isAssignable) will check identity assignable of $(D Lhs).
+If you omit `Rhs`, `isAssignable` will check identity assignable of `Lhs`.
 */
 enum isAssignable(Lhs, Rhs = Lhs) = isRvalueAssignable!(Lhs, Rhs) && isLvalueAssignable!(Lhs, Rhs);
 
@@ -4446,7 +4446,7 @@ unittest
 
 
 /*
-Works like $(D isImplicitlyConvertible), except this cares only about storage
+Works like `isImplicitlyConvertible`, except this cares only about storage
 classes of the arguments.
  */
 private template isStorageClassImplicitlyConvertible(From, To)
@@ -4471,8 +4471,8 @@ unittest
 
 
 /**
-Determines whether the function type $(D F) is covariant with $(D G), i.e.,
-functions of the type $(D F) can override ones of the type $(D G).
+Determines whether the function type `F` is covariant with `G`, i.e.,
+functions of the type `F` can override ones of the type `G`.
 
 Example:
 --------------------
@@ -4668,7 +4668,7 @@ unittest
 private struct __InoutWorkaroundStruct{}
 
 /**
-Creates an lvalue or rvalue of type $(D T) for $(D typeof(...)) and
+Creates an lvalue or rvalue of type `T` for `typeof(...)` and
 $(D __traits(compiles, ...)) purposes. No actual value is returned.
 
 Note: Trying to use returned value will result in a
@@ -5137,7 +5137,7 @@ template BuiltinTypeOf(T)
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
 
 /**
- * Detect whether $(D T) is a built-in boolean type.
+ * Detect whether `T` is a built-in boolean type.
  */
 enum bool isBoolean(T) = is(BooleanTypeOf!T) && !isAggregateType!T;
 
@@ -5150,8 +5150,8 @@ unittest
 }
 
 /**
- * Detect whether $(D T) is a built-in integral type. Types $(D bool),
- * $(D char), $(D wchar), and $(D dchar) are not considered integral.
+ * Detect whether `T` is a built-in integral type. Types `bool`,
+ * `char`, `wchar`, and `dchar` are not considered integral.
  */
 enum bool isIntegral(T) = is(IntegralTypeOf!T) && !isAggregateType!T;
 
@@ -5175,7 +5175,7 @@ unittest
 }
 
 /**
- * Detect whether $(D T) is a built-in floating point type.
+ * Detect whether `T` is a built-in floating point type.
  */
 enum bool isFloatingPoint(T) = is(FloatingPointTypeOf!T) && !isAggregateType!T;
 
@@ -5201,7 +5201,7 @@ unittest
 }
 
 /**
-Detect whether $(D T) is a built-in numeric type (integral or floating
+Detect whether `T` is a built-in numeric type (integral or floating
 point).
  */
 enum bool isNumeric(T) = is(NumericTypeOf!T) && !isAggregateType!T;
@@ -5219,7 +5219,7 @@ unittest
 }
 
 /**
-Detect whether $(D T) is a scalar type (a built-in numeric, character or boolean type).
+Detect whether `T` is a scalar type (a built-in numeric, character or boolean type).
  */
 enum bool isScalarType(T) = isNumeric!T || isSomeChar!T || isBoolean!T;
 
@@ -5233,7 +5233,7 @@ unittest
 }
 
 /**
-Detect whether $(D T) is a basic type (scalar type or void).
+Detect whether `T` is a basic type (scalar type or void).
  */
 enum bool isBasicType(T) = isScalarType!T || is(T == void);
 
@@ -5247,7 +5247,7 @@ unittest
 }
 
 /**
-Detect whether $(D T) is a built-in unsigned numeric type.
+Detect whether `T` is a built-in unsigned numeric type.
  */
 enum bool isUnsigned(T) = is(UnsignedTypeOf!T) && !isAggregateType!T;
 
@@ -5264,7 +5264,7 @@ unittest
 }
 
 /**
-Detect whether $(D T) is a built-in signed numeric type.
+Detect whether `T` is a built-in signed numeric type.
  */
 enum bool isSigned(T) = is(SignedTypeOf!T) && !isAggregateType!T;
 
@@ -5281,7 +5281,7 @@ unittest
 }
 
 /**
-Detect whether $(D T) is one of the built-in character types.
+Detect whether `T` is one of the built-in character types.
  */
 enum bool isSomeChar(T) = is(CharTypeOf!T) && !isAggregateType!T;
 
@@ -5307,12 +5307,12 @@ unittest
 }
 
 /**
-Detect whether $(D T) is one of the built-in string types.
+Detect whether `T` is one of the built-in string types.
 
-The built-in string types are $(D Char[]), where $(D Char) is any of $(D char),
-$(D wchar) or $(D dchar), with or without qualifiers.
+The built-in string types are `Char[]`, where `Char` is any of `char`,
+`wchar` or `dchar`, with or without qualifiers.
 
-Static arrays of characters (like $(D char[80])) are not considered
+Static arrays of characters (like `char[80]`) are not considered
 built-in string types.
  */
 enum bool isSomeString(T) = is(StringTypeOf!T) && !isAggregateType!T && !isStaticArray!T;
@@ -5359,7 +5359,7 @@ unittest
 }
 
 /**
- * Detect whether type $(D T) is a static array.
+ * Detect whether type `T` is a static array.
  */
 enum bool isStaticArray(T) = is(StaticArrayTypeOf!T) && !isAggregateType!T;
 
@@ -5390,7 +5390,7 @@ unittest
 }
 
 /**
- * Detect whether type $(D T) is a dynamic array.
+ * Detect whether type `T` is a dynamic array.
  */
 enum bool isDynamicArray(T) = is(DynamicArrayTypeOf!T) && !isAggregateType!T;
 
@@ -5413,7 +5413,7 @@ unittest
 }
 
 /**
- * Detect whether type $(D T) is an array (static or dynamic; for associative
+ * Detect whether type `T` is an array (static or dynamic; for associative
  *  arrays see $(LREF isAssociativeArray)).
  */
 enum bool isArray(T) = isStaticArray!T || isDynamicArray!T;
@@ -5435,7 +5435,7 @@ unittest
 }
 
 /**
- * Detect whether $(D T) is an associative array type
+ * Detect whether `T` is an associative array type
  */
 enum bool isAssociativeArray(T) = is(AssocArrayTypeOf!T) && !isAggregateType!T;
 
@@ -5466,12 +5466,12 @@ unittest
 }
 
 /**
- * Detect whether type $(D T) is a builtin type.
+ * Detect whether type `T` is a builtin type.
  */
 enum bool isBuiltinType(T) = is(BuiltinTypeOf!T) && !isAggregateType!T;
 
 /**
- * Detect whether type $(D T) is a SIMD vector type.
+ * Detect whether type `T` is a SIMD vector type.
  */
 enum bool isSIMDVector(T) = is(T : __vector(V[N]), V, size_t N);
 
@@ -5488,7 +5488,7 @@ unittest
 }
 
 /**
- * Detect whether type $(D T) is a pointer.
+ * Detect whether type `T` is a pointer.
  */
 enum bool isPointer(T) = is(T == U*, U) && !isAggregateType!T;
 
@@ -5530,16 +5530,16 @@ unittest
 }
 
 /**
- * Detect whether type $(D T) is an aggregate type.
+ * Detect whether type `T` is an aggregate type.
  */
 enum bool isAggregateType(T) = is(T == struct) || is(T == union) ||
                                is(T == class) || is(T == interface);
 
 /**
- * Returns $(D true) if T can be iterated over using a $(D foreach) loop with
+ * Returns `true` if T can be iterated over using a `foreach` loop with
  * a single loop variable of automatically inferred type, regardless of how
- * the $(D foreach) loop is implemented.  This includes ranges, structs/classes
- * that define $(D opApply) with a single loop variable, and builtin dynamic,
+ * the `foreach` loop is implemented.  This includes ranges, structs/classes
+ * that define `opApply` with a single loop variable, and builtin dynamic,
  * static and associative arrays.
  */
 enum bool isIterable(T) = is(typeof({ foreach(elem; T.init) {} }));
@@ -5653,7 +5653,7 @@ unittest
 
 
 /**
- * Check whether the tuple $(D T) is a type tuple.
+ * Check whether the tuple `T` is a type tuple.
  * A type tuple only contains types.
  *
  * See_Also: $(LREF isExpressionTuple).
@@ -5696,7 +5696,7 @@ unittest
 
 
 /**
-Detect whether symbol or type $(D T) is a function pointer.
+Detect whether symbol or type `T` is a function pointer.
  */
 template isFunctionPointer(T...)
     if (T.length == 1)
@@ -5731,7 +5731,7 @@ unittest
 }
 
 /**
-Detect whether symbol or type $(D T) is a delegate.
+Detect whether symbol or type `T` is a delegate.
 */
 template isDelegate(T...)
     if (T.length == 1)
@@ -5768,7 +5768,7 @@ unittest
 }
 
 /**
-Detect whether symbol or type $(D T) is a function, a function pointer or a delegate.
+Detect whether symbol or type `T` is a function, a function pointer or a delegate.
  */
 template isSomeFunction(T...)
     if (T.length == 1)
@@ -5828,7 +5828,7 @@ unittest
 
 
 /**
-Detect whether $(D T) is a callable object, which can be called with the
+Detect whether `T` is a callable object, which can be called with the
 function call operator $(D $(LPAREN)...$(RPAREN)).
  */
 template isCallable(T...)
@@ -5862,7 +5862,7 @@ unittest
 
 
 /**
- * Detect whether $(D T) is a an abstract function.
+ * Detect whether `T` is a an abstract function.
  */
 template isAbstractFunction(T...)
     if (T.length == 1)
@@ -5881,7 +5881,7 @@ unittest
 }
 
 /**
- * Detect whether $(D T) is a a final function.
+ * Detect whether `T` is a a final function.
  */
 template isFinalFunction(T...)
     if (T.length == 1)
@@ -5905,7 +5905,7 @@ unittest
 }
 
 /**
-Determines whether function $(D f) requires a context pointer.
+Determines whether function `f` requires a context pointer.
 */
 template isNestedFunction(alias f)
 {
@@ -5921,7 +5921,7 @@ unittest
 }
 
 /**
- * Detect whether $(D T) is a an abstract class.
+ * Detect whether `T` is a an abstract class.
  */
 template isAbstractClass(T...)
     if (T.length == 1)
@@ -5940,7 +5940,7 @@ unittest
 }
 
 /**
- * Detect whether $(D T) is a a final class.
+ * Detect whether `T` is a a final class.
  */
 template isFinalClass(T...)
     if (T.length == 1)
@@ -5965,7 +5965,7 @@ unittest
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
 
 /**
-Removes all qualifiers, if any, from type $(D T).
+Removes all qualifiers, if any, from type `T`.
 
 Example:
 ----
@@ -6046,9 +6046,9 @@ unittest
 
 /**
 Returns the inferred type of the loop variable when a variable of type T
-is iterated over using a $(D foreach) loop with a single loop variable and
+is iterated over using a `foreach` loop with a single loop variable and
 automatically inferred return type.  Note that this may not be the same as
-$(D std.range.ElementType!Range) in the case of narrow strings, or if T
+`std.range.ElementType!Range` in the case of narrow strings, or if T
 has both opApply and a range interface.
 */
 template ForeachType(T)
@@ -6074,7 +6074,7 @@ unittest
 
 
 /**
- * Strips off all $(D enum)s from type $(D T).
+ * Strips off all `enum`s from type `T`.
  */
 template OriginalType(T)
 {
@@ -6294,9 +6294,9 @@ unittest
 //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
 
 /**
-Returns the mangled name of symbol or type $(D sth).
+Returns the mangled name of symbol or type `sth`.
 
-$(D mangledName) is the same as builtin $(D .mangleof) property, except that
+`mangledName` is the same as builtin `.mangleof` property, except that
 the correct names of property functions are obtained.
 --------------------
 module test;
@@ -6407,8 +6407,8 @@ unittest
 // XXX Select & select should go to another module. (functional or algorithm?)
 
 /**
-Aliases itself to $(D T[0]) if the boolean $(D condition) is $(D true)
-and to $(D T[1]) otherwise.
+Aliases itself to `T[0]` if the boolean `condition` is `true`
+and to `T[1]` otherwise.
  */
 template Select(bool condition, T...) if (T.length == 2)
 {
@@ -6432,8 +6432,8 @@ unittest
 }
 
 /**
-If $(D cond) is $(D true), returns $(D a) without evaluating $(D
-b). Otherwise, returns $(D b) without evaluating $(D a).
+If `cond` is `true`, returns `a` without evaluating $(D
+b). Otherwise, returns `b` without evaluating `a`.
  */
 A select(bool cond : true, A, B)(A a, lazy B b) { return a; }
 /// Ditto
diff --git a/std/typecons.d b/std/typecons.d
index b366b451897..acef678f4b0 100644
--- a/std/typecons.d
+++ b/std/typecons.d
@@ -50,15 +50,15 @@ import std.typetuple; // : TypeTuple, allSatisfy;
 debug(Unique) import std.stdio;
 
 /**
-Encapsulates unique ownership of a resource.  Resource of type $(D T) is
+Encapsulates unique ownership of a resource.  Resource of type `T` is
 deleted at the end of the scope, unless it is transferred.  The
-transfer can be explicit, by calling $(D release), or implicit, when
+transfer can be explicit, by calling `release`, or implicit, when
 returning Unique from a function. The resource can be a polymorphic
 class object, in which case Unique behaves polymorphically too.
 */
 struct Unique(T)
 {
-/** Represents a reference to $(D T). Resolves to $(D T*) if $(D T) is a value type. */
+/** Represents a reference to `T`. Resolves to `T*` if `T` is a value type. */
 static if (is(T:Object))
     alias RefT = T;
 else
@@ -68,12 +68,12 @@ public:
     // Deferred in case we get some language support for checking uniqueness.
     version(None)
     /**
-    Allows safe construction of $(D Unique). It creates the resource and
-    guarantees unique ownership of it (unless $(D T) publishes aliases of
-    $(D this)).
+    Allows safe construction of `Unique`. It creates the resource and
+    guarantees unique ownership of it (unless `T` publishes aliases of
+    `this`).
     Note: Nested structs/classes cannot be created.
     Params:
-    args = Arguments to pass to $(D T)'s constructor.
+    args = Arguments to pass to `T`'s constructor.
     ---
     static class C {}
     auto u = Unique!(C).create();
@@ -115,10 +115,10 @@ public:
         assert(p is null);
     }
     /**
-    Constructor that takes a $(D Unique) of a type that is convertible to our type.
+    Constructor that takes a `Unique` of a type that is convertible to our type.
 
-    Typically used to transfer a $(D Unique) rvalue of derived type to
-    a $(D Unique) of base type.
+    Typically used to transfer a `Unique` rvalue of derived type to
+    a `Unique` of base type.
     Example:
     ---
     class C : Object {}
@@ -135,7 +135,7 @@ public:
         u._p = null;
     }
 
-    /// Transfer ownership from a $(D Unique) of a type that is convertible to our type.
+    /// Transfer ownership from a `Unique` of a type that is convertible to our type.
     void opAssign(U)(Unique!U u)
     if (is(u.RefT:RefT))
     {
@@ -157,7 +157,7 @@ public:
     {
         return _p is null;
     }
-    /** Transfer ownership to a $(D Unique) rvalue. Nullifies the current contents. */
+    /** Transfer ownership to a `Unique` rvalue. Nullifies the current contents. */
     Unique release()
     {
         debug(Unique) writeln("Release");
@@ -170,7 +170,7 @@ public:
     RefT opDot() { return _p; }
 
     /**
-    Postblit operator is undefined to prevent the cloning of $(D Unique) objects.
+    Postblit operator is undefined to prevent the cloning of `Unique` objects.
     */
     @disable this(this);
 
@@ -294,10 +294,10 @@ unittest
 
 /**
 Tuple of values, for example $(D Tuple!(int, string)) is a record that
-stores an $(D int) and a $(D string). $(D Tuple) can be used to bundle
+stores an `int` and a `string`. `Tuple` can be used to bundle
 values together, notably when returning multiple values from a
-function. If $(D obj) is a tuple, the individual members are
-accessible with the syntax $(D obj[0]) for the first field, $(D obj[1])
+function. If `obj` is a tuple, the individual members are
+accessible with the syntax `obj[0]` for the first field, `obj[1]`
 for the second, and so on.
 
 The choice of zero-based indexing instead of one-base indexing was
@@ -452,7 +452,7 @@ template Tuple(Specs...)
             static assert(isBuildable!(Tup1.Types[i], Tup2.Types[i]));
     }));
 
-    /+ Returns $(D true) iff a $(D T) can be initialized from a $(D U). +/
+    /+ Returns `true` iff a `T` can be initialized from a `U`. +/
     enum isBuildable(T, U) =  is(typeof(
     {
         U u = U.init;
@@ -483,9 +483,9 @@ template Tuple(Specs...)
         alias fieldNames = staticMap!(extractName, fieldSpecs);
 
         /**
-         * Use $(D t.expand) for a tuple $(D t) to expand it into its
-         * components. The result of $(D expand) acts as if the tuple components
-         * were listed as a list of values. (Ordinarily, a $(D Tuple) acts as a
+         * Use `t.expand` for a tuple `t` to expand it into its
+         * components. The result of `expand` acts as if the tuple components
+         * were listed as a list of values. (Ordinarily, a `Tuple` acts as a
          * single value.)
          *
          * Examples:
@@ -1132,7 +1132,7 @@ unittest
 }
 
 /**
-Returns a $(D Tuple) object instantiated and initialized according to
+Returns a `Tuple` object instantiated and initialized according to
 the arguments.
 
 Example:
@@ -1191,8 +1191,8 @@ template tuple(Names...)
 }
 
 /**
-Returns $(D true) if and only if $(D T) is an instance of the
-$(D Tuple) struct template.
+Returns `true` if and only if `T` is an instance of the
+`Tuple` struct template.
  */
 template isTuple(T)
 {
@@ -1270,13 +1270,13 @@ private mixin template RebindableCommon(T, U, alias This)
 }
 
 /**
-$(D Rebindable!(T)) is a simple, efficient wrapper that behaves just
-like an object of type $(D T), except that you can reassign it to
-refer to another object. For completeness, $(D Rebindable!(T)) aliases
-itself away to $(D T) if $(D T) is a non-const object type. However,
-$(D Rebindable!(T)) does not compile if $(D T) is a non-class type.
+`Rebindable!(T)` is a simple, efficient wrapper that behaves just
+like an object of type `T`, except that you can reassign it to
+refer to another object. For completeness, `Rebindable!(T)` aliases
+itself away to `T` if `T` is a non-const object type. However,
+`Rebindable!(T)` does not compile if `T` is a non-class type.
 
-Regular $(D const) object references cannot be reassigned:
+Regular `const` object references cannot be reassigned:
 
 ----
 class Widget { int x; int y() const { return x; } }
@@ -1286,7 +1286,7 @@ a.x = 5;        // error! can't modify const a
 a = new Widget; // error! can't modify const a
 ----
 
-However, $(D Rebindable!(Widget)) does allow reassignment, while
+However, `Rebindable!(Widget)` does allow reassignment, while
 otherwise behaving exactly like a $(D const Widget):
 
 ----
@@ -1296,11 +1296,11 @@ a.x = 5;        // error! can't modify const a
 a = new Widget; // fine
 ----
 
-You may want to use $(D Rebindable) when you want to have mutable
-storage referring to $(D const) objects, for example an array of
-references that must be sorted in place. $(D Rebindable) does not
+You may want to use `Rebindable` when you want to have mutable
+storage referring to `const` objects, for example an array of
+references that must be sorted in place. `Rebindable` does not
 break the soundness of D's type system and does not incur any of the
-risks usually associated with $(D cast).
+risks usually associated with `cast`.
 
  */
 template Rebindable(T) if (is(T == class) || is(T == interface) || isDynamicArray!T)
@@ -1327,7 +1327,7 @@ template Rebindable(T) if (is(T == class) || is(T == interface) || isDynamicArra
 }
 
 /**
-Convenience function for creating a $(D Rebindable) using automatic type
+Convenience function for creating a `Rebindable` using automatic type
 inference.
 */
 Rebindable!T rebindable(T)(T obj)
@@ -1339,9 +1339,9 @@ if (is(T == class) || is(T == interface) || isDynamicArray!T)
 }
 
 /**
-This function simply returns the $(D Rebindable) object passed in.  It's useful
+This function simply returns the `Rebindable` object passed in.  It's useful
 in generic programming cases when a given object may be either a regular
-$(D class) or a $(D Rebindable).
+`class` or a `Rebindable`.
 */
 Rebindable!T rebindable(T)(Rebindable!T obj)
 {
@@ -1432,7 +1432,7 @@ unittest
 }
 
 /**
-    Similar to $(D Rebindable!(T)) but strips all qualifiers from the reference as
+    Similar to `Rebindable!(T)` but strips all qualifiers from the reference as
     opposed to just constness / immutability. Primary intended use case is with
     shared (having thread-local reference to shared class data)
  */
@@ -1549,7 +1549,7 @@ unittest
 Defines a value paired with a distinctive "null" state that denotes
 the absence of a value. If default constructed, a $(D
 Nullable!T) object starts in the null state. Assigning it renders it
-non-null. Calling $(D nullify) can nullify it again.
+non-null. Calling `nullify` can nullify it again.
 
 Example:
 ----
@@ -1560,7 +1560,7 @@ assert(!a.isNull);
 assert(a == 5);
 ----
 
-Practically $(D Nullable!T) stores a $(D T) and a $(D bool).
+Practically `Nullable!T` stores a `T` and a `bool`.
  */
 struct Nullable(T)
 {
@@ -1568,7 +1568,7 @@ struct Nullable(T)
     private bool _isNull = true;
 
 /**
-Constructor initializing $(D this) with $(D value).
+Constructor initializing `this` with `value`.
  */
     this(inout T value) inout
     {
@@ -1594,7 +1594,7 @@ Constructor initializing $(D this) with $(D value).
     }
 
 /**
-Returns $(D true) if and only if $(D this) is in the null state.
+Returns `true` if and only if `this` is in the null state.
  */
     @property bool isNull() const @safe pure nothrow
     {
@@ -1602,7 +1602,7 @@ Returns $(D true) if and only if $(D this) is in the null state.
     }
 
 /**
-Forces $(D this) to the null state.
+Forces `this` to the null state.
  */
     void nullify()()
     {
@@ -1611,8 +1611,8 @@ Forces $(D this) to the null state.
     }
 
 /**
-Assigns $(D value) to the internally-held state. If the assignment
-succeeds, $(D this) becomes non-null.
+Assigns `value` to the internally-held state. If the assignment
+succeeds, `this` becomes non-null.
  */
     void opAssign()(T value)
     {
@@ -1621,8 +1621,8 @@ succeeds, $(D this) becomes non-null.
     }
 
 /**
-Gets the value. $(D this) must not be in the null state.
-This function is also called for the implicit conversion to $(D T).
+Gets the value. `this` must not be in the null state.
+This function is also called for the implicit conversion to `T`.
  */
     @property ref inout(T) get() inout @safe pure nothrow
     {
@@ -1632,8 +1632,8 @@ This function is also called for the implicit conversion to $(D T).
     }
 
 /**
-Implicitly converts to $(D T).
-$(D this) must not be in the null state.
+Implicitly converts to `T`.
+`this` must not be in the null state.
  */
     alias get this;
 }
@@ -1911,18 +1911,18 @@ unittest
 }
 
 /**
-Just like $(D Nullable!T), except that the null state is defined as a
+Just like `Nullable!T`, except that the null state is defined as a
 particular value. For example, $(D Nullable!(uint, uint.max)) is an
-$(D uint) that sets aside the value $(D uint.max) to denote a null
+`uint` that sets aside the value `uint.max` to denote a null
 state. $(D Nullable!(T, nullValue)) is more storage-efficient than $(D
-Nullable!T) because it does not need to store an extra $(D bool).
+Nullable!T) because it does not need to store an extra `bool`.
  */
 struct Nullable(T, T nullValue)
 {
     private T _value = nullValue;
 
 /**
-Constructor initializing $(D this) with $(D value).
+Constructor initializing `this` with `value`.
  */
     this(T value)
     {
@@ -1947,7 +1947,7 @@ Constructor initializing $(D this) with $(D value).
     }
 
 /**
-Returns $(D true) if and only if $(D this) is in the null state.
+Returns `true` if and only if `this` is in the null state.
  */
     @property bool isNull() const
     {
@@ -1964,7 +1964,7 @@ Returns $(D true) if and only if $(D this) is in the null state.
     }
 
 /**
-Forces $(D this) to the null state.
+Forces `this` to the null state.
  */
     void nullify()()
     {
@@ -1972,8 +1972,8 @@ Forces $(D this) to the null state.
     }
 
 /**
-Assigns $(D value) to the internally-held state. No null checks are
-made. Note that the assignment may leave $(D this) in the null state.
+Assigns `value` to the internally-held state. No null checks are
+made. Note that the assignment may leave `this` in the null state.
  */
     void opAssign()(T value)
     {
@@ -1981,8 +1981,8 @@ made. Note that the assignment may leave $(D this) in the null state.
     }
 
 /**
-Gets the value. $(D this) must not be in the null state.
-This function is also called for the implicit conversion to $(D T).
+Gets the value. `this` must not be in the null state.
+This function is also called for the implicit conversion to `T`.
  */
     @property ref inout(T) get() inout
     {
@@ -1994,8 +1994,8 @@ This function is also called for the implicit conversion to $(D T).
     }
 
 /**
-Implicitly converts to $(D T).
-Gets the value. $(D this) must not be in the null state.
+Implicitly converts to `T`.
+Gets the value. `this` must not be in the null state.
  */
     alias get this;
 }
@@ -2128,17 +2128,17 @@ unittest
 
 
 /**
-Just like $(D Nullable!T), except that the object refers to a value
+Just like `Nullable!T`, except that the object refers to a value
 sitting elsewhere in memory. This makes assignments overwrite the
-initially assigned value. Internally $(D NullableRef!T) only stores a
-pointer to $(D T) (i.e., $(D Nullable!T.sizeof == (T*).sizeof)).
+initially assigned value. Internally `NullableRef!T` only stores a
+pointer to `T` (i.e., $(D Nullable!T.sizeof == (T*).sizeof)).
  */
 struct NullableRef(T)
 {
     private T* _value;
 
 /**
-Constructor binding $(D this) with $(D value).
+Constructor binding `this` with `value`.
  */
     this(T* value) @safe pure nothrow
     {
@@ -2163,7 +2163,7 @@ Constructor binding $(D this) with $(D value).
     }
 
 /**
-Binds the internal state to $(D value).
+Binds the internal state to `value`.
  */
     void bind(T* value) @safe pure nothrow
     {
@@ -2171,7 +2171,7 @@ Binds the internal state to $(D value).
     }
 
 /**
-Returns $(D true) if and only if $(D this) is in the null state.
+Returns `true` if and only if `this` is in the null state.
  */
     @property bool isNull() const @safe pure nothrow
     {
@@ -2179,7 +2179,7 @@ Returns $(D true) if and only if $(D this) is in the null state.
     }
 
 /**
-Forces $(D this) to the null state.
+Forces `this` to the null state.
  */
     void nullify() @safe pure nothrow
     {
@@ -2187,7 +2187,7 @@ Forces $(D this) to the null state.
     }
 
 /**
-Assigns $(D value) to the internally-held state.
+Assigns `value` to the internally-held state.
  */
     void opAssign()(T value)
         if (isAssignable!T) //@@@9416@@@
@@ -2198,8 +2198,8 @@ Assigns $(D value) to the internally-held state.
     }
 
 /**
-Gets the value. $(D this) must not be in the null state.
-This function is also called for the implicit conversion to $(D T).
+Gets the value. `this` must not be in the null state.
+This function is also called for the implicit conversion to `T`.
  */
     @property ref inout(T) get() inout @safe pure nothrow
     {
@@ -2209,8 +2209,8 @@ This function is also called for the implicit conversion to $(D T).
     }
 
 /**
-Implicitly converts to $(D T).
-$(D this) must not be in the null state.
+Implicitly converts to `T`.
+`this` must not be in the null state.
  */
     alias get this;
 }
@@ -2351,8 +2351,8 @@ unittest
 
 
 /**
-$(D BlackHole!Base) is a subclass of $(D Base) which automatically implements
-all abstract member functions in $(D Base) as do-nothing functions.  Each
+`BlackHole!Base` is a subclass of `Base` which automatically implements
+all abstract member functions in `Base` as do-nothing functions.  Each
 auto-implemented function just returns the default value of the return type
 without doing anything.
 
@@ -2432,9 +2432,9 @@ unittest
 
 
 /**
-$(D WhiteHole!Base) is a subclass of $(D Base) which automatically implements
+`WhiteHole!Base` is a subclass of `Base` which automatically implements
 all abstract member functions as throw-always functions.  Each auto-implemented
-function fails with throwing an $(D Error) and does never return.  Useful for
+function fails with throwing an `Error` and does never return.  Useful for
 trapping use of not-yet-implemented functions.
 
 The name came from
@@ -2502,22 +2502,22 @@ unittest
 
 
 /**
-$(D AutoImplement) automatically implements (by default) all abstract member
-functions in the class or interface $(D Base) in specified way.
+`AutoImplement` automatically implements (by default) all abstract member
+functions in the class or interface `Base` in specified way.
 
 Params:
   how  = template which specifies _how functions will be implemented/overridden.
 
-         Two arguments are passed to $(D how): the type $(D Base) and an alias
-         to an implemented function.  Then $(D how) must return an implemented
+         Two arguments are passed to `how`: the type `Base` and an alias
+         to an implemented function.  Then `how` must return an implemented
          function body as a string.
 
          The generated function body can use these keywords:
          $(UL
-            $(LI $(D a0), $(D a1), …: arguments passed to the function;)
-            $(LI $(D args): a tuple of the arguments;)
-            $(LI $(D self): an alias to the function itself;)
-            $(LI $(D parent): an alias to the overridden function (if any).)
+            $(LI `a0`, `a1`, …: arguments passed to the function;)
+            $(LI `args`: a tuple of the arguments;)
+            $(LI `self`: an alias to the function itself;)
+            $(LI `parent`: an alias to the overridden function (if any).)
          )
 
         You may want to use templated property functions (instead of Implicit
@@ -2550,9 +2550,9 @@ string generateLogger(C, alias fun)() @property
   what = template which determines _what functions should be
          implemented/overridden.
 
-         An argument is passed to $(D what): an alias to a non-final member
-         function in $(D Base).  Then $(D what) must return a boolean value.
-         Return $(D true) to indicate that the passed function should be
+         An argument is passed to `what`: an alias to a non-final member
+         function in `Base`.  Then `what` must return a boolean value.
+         Return `true` to indicate that the passed function should be
          implemented/overridden.
 
 --------------------
@@ -2563,10 +2563,10 @@ enum bool hasValue(alias fun) = !is(ReturnType!(fun) == void);
 
 Note:
 
-Generated code is inserted in the scope of $(D std.typecons) module.  Thus,
-any useful functions outside $(D std.typecons) cannot be used in the generated
-code.  To workaround this problem, you may $(D import) necessary things in a
-local struct, as done in the $(D generateLogger()) template in the above
+Generated code is inserted in the scope of `std.typecons` module.  Thus,
+any useful functions outside `std.typecons` cannot be used in the generated
+code.  To workaround this problem, you may `import` necessary things in a
+local struct, as done in the `generateLogger()` template in the above
 example.
 
 
@@ -2577,9 +2577,9 @@ $(UL
  $(LI Deep interface inheritance causes compile error with messages like
       "Error: function std.typecons._AutoImplement!(Foo)._AutoImplement.bar
       does not override any function".  [$(BUGZILLA 2525), $(BUGZILLA 3525)] )
- $(LI The $(D parent) keyword is actually a delegate to the super class'
+ $(LI The `parent` keyword is actually a delegate to the super class'
       corresponding member function.  [$(BUGZILLA 2540)] )
- $(LI Using alias template parameter in $(D how) and/or $(D what) may cause
+ $(LI Using alias template parameter in `how` and/or `what` may cause
      strange compile error.  Use template tuple parameter instead to workaround
      this problem.  [$(BUGZILLA 4217)] )
 )
@@ -3208,8 +3208,8 @@ private static:
 
 
 /**
-Predefined how-policies for $(D AutoImplement).  These templates are used by
-$(D BlackHole) and $(D WhiteHole), respectively.
+Predefined how-policies for `AutoImplement`.  These templates are used by
+`BlackHole` and `WhiteHole`, respectively.
  */
 template generateEmptyFunction(C, func.../+[BUG 4217]+/)
 {
@@ -3286,9 +3286,9 @@ unittest
 /**
  * Supports structural based typesafe conversion.
  *
- * If $(D Source) has structural conformance with the $(D interface) $(D Targets),
- * wrap creates internal wrapper class which inherits $(D Targets) and
- * wrap $(D src) object, then return it.
+ * If `Source` has structural conformance with the `interface` `Targets`,
+ * wrap creates internal wrapper class which inherits `Targets` and
+ * wrap `src` object, then return it.
  */
 template wrap(Targets...)
 if (Targets.length >= 1 && allSatisfy!(isMutable, Targets))
@@ -3478,7 +3478,7 @@ private interface Structural
 }
 
 /**
- * Extract object which wrapped by $(D wrap).
+ * Extract object which wrapped by `wrap`.
  */
 template unwrap(Target)
 if (isMutable!Target)
@@ -3993,8 +3993,8 @@ private template Bind(alias Template, args1...)
 
 
 /**
-Options regarding auto-initialization of a $(D RefCounted) object (see
-the definition of $(D RefCounted) below).
+Options regarding auto-initialization of a `RefCounted` object (see
+the definition of `RefCounted` below).
  */
 enum RefCountedAutoInitialize
 {
@@ -4005,26 +4005,26 @@ enum RefCountedAutoInitialize
 }
 
 /**
-Defines a reference-counted object containing a $(D T) value as
-payload. $(D RefCounted) keeps track of all references of an object,
+Defines a reference-counted object containing a `T` value as
+payload. `RefCounted` keeps track of all references of an object,
 and when the reference count goes down to zero, frees the underlying
-store. $(D RefCounted) uses $(D malloc) and $(D free) for operation.
+store. `RefCounted` uses `malloc` and `free` for operation.
 
-$(D RefCounted) is unsafe and should be used with care. No references
-to the payload should be escaped outside the $(D RefCounted) object.
+`RefCounted` is unsafe and should be used with care. No references
+to the payload should be escaped outside the `RefCounted` object.
 
-The $(D autoInit) option makes the object ensure the store is
+The `autoInit` option makes the object ensure the store is
 automatically initialized. Leaving $(D autoInit ==
 RefCountedAutoInitialize.yes) (the default option) is convenient but
 has the cost of a test whenever the payload is accessed. If $(D
 autoInit == RefCountedAutoInitialize.no), user code must call either
-$(D refCountedStore.isInitialized) or $(D refCountedStore.ensureInitialized)
+`refCountedStore.isInitialized` or `refCountedStore.ensureInitialized`
 before attempting to access the payload. Not doing so results in null
 pointer dereference.
 
 Example:
 ----
-// A pair of an $(D int) and a $(D size_t) - the latter being the
+// A pair of an `int` and a $(D size_t) - the latter being the
 // reference count - will be dynamically allocated
 auto rc1 = RefCounted!int(5);
 assert(rc1 == 5);
@@ -4040,7 +4040,7 @@ struct RefCounted(T, RefCountedAutoInitialize autoInit =
         RefCountedAutoInitialize.yes)
 if (!is(T == class))
 {
-    /// $(D RefCounted) storage implementation.
+    /// `RefCounted` storage implementation.
     struct RefCountedStore
     {
         private struct Impl
@@ -4066,7 +4066,7 @@ if (!is(T == class))
         }
 
         /**
-           Returns $(D true) if and only if the underlying store has been
+           Returns `true` if and only if the underlying store has been
            allocated and initialized.
         */
         @property nothrow @safe
@@ -4077,7 +4077,7 @@ if (!is(T == class))
 
         /**
            Returns underlying reference count if it is allocated and initialized
-           (a positive integer), and $(D 0) otherwise.
+           (a positive integer), and `0` otherwise.
         */
         @property nothrow @safe
         size_t refCount() const
@@ -4107,7 +4107,7 @@ if (!is(T == class))
 /**
 Constructor that initializes the payload.
 
-Postcondition: $(D refCountedStore.isInitialized)
+Postcondition: `refCountedStore.isInitialized`
  */
     this(A...)(auto ref A args) if (A.length > 0)
     {
@@ -4127,7 +4127,7 @@ Constructor that tracks the reference count appropriately. If $(D
 /**
 Destructor that tracks the reference count appropriately. If $(D
 !refCountedStore.isInitialized), does nothing. When the reference count goes
-down to zero, calls $(D destroy) agaist the payload and calls $(D free)
+down to zero, calls `destroy` agaist the payload and calls `free`
 to deallocate the corresponding resource.
  */
     ~this()
@@ -4182,13 +4182,13 @@ Assignment operators
         RefCountedAutoInitialize.yes), calls $(D
         refCountedStore.ensureInitialized). Otherwise, just issues $(D
         assert(refCountedStore.isInitialized)). Used with $(D alias
-        refCountedPayload this;), so callers can just use the $(D RefCounted)
-        object as a $(D T).
+        refCountedPayload this;), so callers can just use the `RefCounted`
+        object as a `T`.
 
         $(BLUE The first overload exists only if $(D autoInit == RefCountedAutoInitialize.yes).)
         So if $(D autoInit == RefCountedAutoInitialize.no)
         or called for a constant or immutable object, then
-        $(D refCountedPayload) will also be qualified as safe and nothrow
+        `refCountedPayload` will also be qualified as safe and nothrow
         (but will still assert if not initialized).
          */
         @property
@@ -4312,7 +4312,7 @@ unittest
 }
 
 /**
-Make proxy for $(D a).
+Make proxy for `a`.
 
 Example:
 ----
@@ -4852,7 +4852,7 @@ unittest
 
 /**
 $(B Typedef) allows the creation of a unique type which is
-based on an existing type. Unlike the $(D alias) feature,
+based on an existing type. Unlike the `alias` feature,
 $(B Typedef) ensures the two types are not considered as equals.
 
 Example:
@@ -4881,7 +4881,7 @@ assert(myInt == 10);  // default-initialized to 10
 ----
 
 cookie = Optional, used to create multiple unique types which are
-based on the same origin type $(D T). For example:
+based on the same origin type `T`. For example:
 
 ----
 alias TypeInt1 = Typedef!int;
@@ -4898,7 +4898,7 @@ static assert(!is(MoneyEuros == MoneyDollars));
 ----
 
 Note: If a library routine cannot handle the Typedef type,
-you can use the $(D TypedefType) template to extract the
+you can use the `TypedefType` template to extract the
 type which the Typedef wraps.
  */
 struct Typedef(T, T init = T.init, string cookie=null)
@@ -4931,8 +4931,8 @@ struct Typedef(T, T init = T.init, string cookie=null)
 }
 
 /**
-Get the underlying type which a $(D Typedef) wraps.
-If $(D T) is not a $(D Typedef) it will alias itself to $(D T).
+Get the underlying type which a `Typedef` wraps.
+If `T` is not a `Typedef` it will alias itself to `T`.
 */
 template TypedefType(T)
 {
@@ -5128,8 +5128,8 @@ unittest
 }
 
 /**
-Allocates a $(D class) object right inside the current scope,
-therefore avoiding the overhead of $(D new). This facility is unsafe;
+Allocates a `class` object right inside the current scope,
+therefore avoiding the overhead of `new`. This facility is unsafe;
 it is the responsibility of the user to not escape a reference to the
 object outside the scope.
 
@@ -5483,13 +5483,13 @@ unittest
 Defines a simple, self-documenting yes/no flag. This makes it easy for
 APIs to define functions accepting flags without resorting to $(D
 bool), which is opaque in calls, and without needing to define an
-enumerated type separately. Using $(D Flag!"Name") instead of $(D
+enumerated type separately. Using `Flag!"Name"` instead of $(D
 bool) makes the flag's meaning visible in calls. Each yes/no flag has
 its own type, which makes confusions and mix-ups impossible.
 
 Example:
 
-Code calling $(D getLine) (usually far away from its definition) can't be
+Code calling `getLine` (usually far away from its definition) can't be
 understood without looking at the documentation, even by users familiar with
 the API:
 ----
@@ -5506,8 +5506,8 @@ auto line = getLine(false);
 Assuming the reverse meaning (i.e. "ignoreTerminator") and inserting the wrong
 code compiles and runs with erroneous results.
 
-After replacing the boolean parameter with an instantiation of $(D Flag), code
-calling $(D getLine) can be easily read and understood even by people not
+After replacing the boolean parameter with an instantiation of `Flag`, code
+calling `getLine` can be easily read and understood even by people not
 fluent with the API:
 
 ----
@@ -5521,11 +5521,11 @@ string getLine(Flag!"keepTerminator" keepTerminator)
 auto line = getLine(Flag!"keepTerminator".yes);
 ----
 
-Passing categorical data by means of unstructured $(D bool)
+Passing categorical data by means of unstructured `bool`
 parameters is classified under "simple-data coupling" by Steve
 McConnell in the $(LUCKY Code Complete) book, along with three other
 kinds of coupling. The author argues citing several studies that
-coupling has a negative effect on code quality. $(D Flag) offers a
+coupling has a negative effect on code quality. `Flag` offers a
 simple structuring method for passing yes/no flags to APIs.
 
 An alias can be used to reduce the verbosity of the flag's type:
@@ -5547,15 +5547,15 @@ template Flag(string name) {
     enum Flag : bool
     {
         /**
-         When creating a value of type $(D Flag!"Name"), use $(D
+         When creating a value of type `Flag!"Name"`, use $(D
          Flag!"Name".no) for the negative option. When using a value
-         of type $(D Flag!"Name"), compare it against $(D
-         Flag!"Name".no) or just $(D false) or $(D 0).  */
+         of type `Flag!"Name"`, compare it against $(D
+         Flag!"Name".no) or just `false` or `0`.  */
         no = false,
 
-        /** When creating a value of type $(D Flag!"Name"), use $(D
+        /** When creating a value of type `Flag!"Name"`, use $(D
          Flag!"Name".yes) for the affirmative option. When using a
-         value of type $(D Flag!"Name"), compare it against $(D
+         value of type `Flag!"Name"`, compare it against $(D
          Flag!"Name".yes).
         */
         yes = true
@@ -5563,8 +5563,8 @@ template Flag(string name) {
 }
 
 /**
-Convenience names that allow using e.g. $(D Yes.encryption) instead of
-$(D Flag!"encryption".yes) and $(D No.encryption) instead of $(D
+Convenience names that allow using e.g. `Yes.encryption` instead of
+`Flag!"encryption".yes` and `No.encryption` instead of $(D
 Flag!"encryption".no).
 */
 struct Yes
@@ -5665,7 +5665,7 @@ A typesafe structure for storing combination of enum values.
 
 This template defines a simple struct to represent bitwise OR combinations of
 enum values. It can be used if all the enum values are integral constants with
-a bit count of at most 1, or if the $(D unsafe) parameter is explicitly set to
+a bit count of at most 1, or if the `unsafe` parameter is explicitly set to
 Yes.
 This is much safer than using the enum itself to store
 the OR combination, which can produce surprising effects like this:
@@ -5826,7 +5826,7 @@ public:
     }
     static assert(__traits(compiles, BitFlags!Enum));
 
-    // You need to specify the $(D unsafe) parameter for enum with custom values
+    // You need to specify the `unsafe` parameter for enum with custom values
     enum UnsafeEnum
     {
         A,
diff --git a/std/typelist.d b/std/typelist.d
index 9609b821bf3..ac8a2e06e3d 100644
--- a/std/typelist.d
+++ b/std/typelist.d
@@ -48,13 +48,13 @@ version(unittest) {
 
 /**
  * Creates a compile-time list of types from a tuple.
- * $(D TypeList)s are more general than tuples because
- * you can pass more than one $(D TypeList) to a template.
+ * `TypeList`s are more general than tuples because
+ * you can pass more than one `TypeList` to a template.
  * You may also combine them into higher-order structures.
- * $(D TypeList)s are passed to other templates as alias parameters
- * To create an empty list use $(D TypeList!())
+ * `TypeList`s are passed to other templates as alias parameters
+ * To create an empty list use `TypeList!()`
  *
- * $(D TypeList) efines several "methods":
+ * `TypeList` efines several "methods":
  *
  * $(D_PARAM toTuple), $(D_PARAM head), $(D_PARAM tail), $(D_PARAM length), $(D_PARAM isEmpty)
  *
@@ -104,7 +104,7 @@ unittest {
 }
 
 /**
- * Appends a type tuple to a $(D TypeList), returns a $(D TypeList)
+ * Appends a type tuple to a `TypeList`, returns a `TypeList`
 */
 template AppendTypes(alias List, T...)
 {
@@ -123,7 +123,7 @@ unittest {
 }
 
 /**
- * Appends one $(D TypeList) to another, returns a $(D TypeList)
+ * Appends one `TypeList` to another, returns a `TypeList`
 */
 template Append(alias Left, alias Right)
 {
@@ -139,7 +139,7 @@ unittest {
 }
 
 /**
- * Prepends a type to a $(D TypeList), returns a $(D TypeList)
+ * Prepends a type to a `TypeList`, returns a `TypeList`
 */
 template Cons(T, alias List)
 {
@@ -160,7 +160,7 @@ unittest {
 }
 
 /**
- * Tests if all emements of a $(D TypeList) against a predicate.
+ * Tests if all emements of a `TypeList` against a predicate.
  * Returns true if all all types satisfy the predicate, false otherwise.
 */
 template All(alias List, alias F)
@@ -187,7 +187,7 @@ unittest {
 }
 
 /**
- * Tests if there is an emement in a $(D TypeList) that satisfies a predicate.
+ * Tests if there is an emement in a `TypeList` that satisfies a predicate.
 */
 template Any(alias List, alias F)
 {
@@ -211,7 +211,7 @@ template Map(alias F, T...)
 }
 
 /**
- * Applies a given "function" to a $(D TypeList). Returns a $(D TypeList) of results
+ * Applies a given "function" to a `TypeList`. Returns a `TypeList` of results
 */
 private template Map(alias F, alias List)
 {
@@ -243,7 +243,7 @@ template Filter(alias Pred, T...)
 }
 
 /**
- * Filters a $(D TypeList) using a predicate. Returns a $(D TypeList) of elements that
+ * Filters a `TypeList` using a predicate. Returns a `TypeList` of elements that
  * satisfy the predicate.
 */
 template Filter(alias Pred, alias List)
@@ -348,7 +348,7 @@ unittest {
 }
 
 /** Negates a type predicate.
- * The negated predicate is a "member" $(D apply).
+ * The negated predicate is a "member" `apply`.
  *
  * Example:
  * ----
@@ -369,7 +369,7 @@ unittest {
 }
 
 /** Combines two type predicates using logical OR.
- * The resulting predicate is callable through the field $(D apply)
+ * The resulting predicate is callable through the field `apply`
  *
  * Example:
  * ----
@@ -391,7 +391,7 @@ unittest {
 }
 
 /** Combines a list of type predicates using logical OR.
- * The resulting predicate is callable through the field $(D apply)
+ * The resulting predicate is callable through the field `apply`
 */
 template Or(alias FList)
 {
@@ -413,7 +413,7 @@ unittest {
 }
 
 /** Combines two type predicates using logical AND.
- * The resulting predicate is callable through the field $(D apply)
+ * The resulting predicate is callable through the field `apply`
  *
  * Example:
  * ----
@@ -435,7 +435,7 @@ unittest {
 }
 
 /** Combines a list of type predicates using logical AND.
- * The resulting predicate is callable through the field $(D apply)
+ * The resulting predicate is callable through the field `apply`
 */
 template And(alias FList)
 {
diff --git a/std/typetuple.d b/std/typetuple.d
index bba40bb81c2..e9661660efb 100644
--- a/std/typetuple.d
+++ b/std/typetuple.d
@@ -652,8 +652,8 @@ unittest
 
 
 /**
- * Filters a $(D TypeTuple) using a template predicate. Returns a
- * $(D TypeTuple) of the elements which satisfy the predicate.
+ * Filters a `TypeTuple` using a template predicate. Returns a
+ * `TypeTuple` of the elements which satisfy the predicate.
  */
 template Filter(alias pred, TList...)
 {
diff --git a/std/uni.d b/std/uni.d
index 432b412608a..cb6e7f03801 100644
--- a/std/uni.d
+++ b/std/uni.d
@@ -1,7 +1,7 @@
 // Written in the D programming language.
 
 /++
-    $(P The $(D std.uni) module provides an implementation
+    $(P The `std.uni` module provides an implementation
     of fundamental Unicode algorithms and data structures.
     This doesn't include UTF encoding and decoding primitives,
     see $(XREF _utf, decode) and $(XREF _utf, encode) in std.utf
@@ -220,11 +220,11 @@
     $(P $(DEF Code unit) The minimal bit combination that can represent
     a unit of encoded text for processing or interchange.
     Depending on the encoding this could be:
-    8-bit code units in the UTF-8 ($(D char)),
-    16-bit code units in the UTF-16 ($(D wchar)),
-    and 32-bit code units in the UTF-32 ($(D dchar)).
+    8-bit code units in the UTF-8 (`char`),
+    16-bit code units in the UTF-16 (`wchar`),
+    and 32-bit code units in the UTF-32 (`dchar`).
     $(I Note that in UTF-32, a code unit is a code point
-    and is represented by the D $(D dchar) type.)
+    and is represented by the D `dchar` type.)
     )
 
     $(P $(DEF Combining character) A character with the General Category
@@ -394,13 +394,13 @@
         the lower bits as an offset within this page.
 
         Assuming that pages are laid out consequently
-        in one array at $(D pages), the pseudo-code is:
+        in one array at `pages`, the pseudo-code is:
     )
     ---
     auto elemsPerPage = (2 ^^ bits_per_page) / Value.sizeOfInBits;
     pages[index[n >> bits_per_page]][n & (elemsPerPage - 1)];
     ---
-    $(P Where if $(D elemsPerPage) is a power of 2 the whole process is
+    $(P Where if `elemsPerPage` is a power of 2 the whole process is
     a handful of simple instructions and 2 array reads. Subsequent levels
     of the trie are introduced by recursing on this notion - the index array
     is treated as values. The number of bits in index is then again
@@ -409,7 +409,7 @@
 
     $(P For completeness a level 1 trie is simply an array.
     The current implementation takes advantage of bit-packing values
-    when the range is known to be limited in advance (such as $(D bool)).
+    when the range is known to be limited in advance (such as `bool`).
     See also $(LREF BitPacked) for enforcing it manually.
     The major size advantage however comes from the fact
     that multiple $(B identical pages on every level are merged) by construction.
@@ -418,7 +418,7 @@
     $(P The process of constructing a trie is more involved and is hidden from
     the user in a form of the convenience functions $(LREF codepointTrie),
     $(LREF codepointSetTrie) and the even more convenient $(LREF toTrie).
-    In general a set or built-in AA with $(D dchar) type
+    In general a set or built-in AA with `dchar` type
     can be turned into a trie. The trie object in this module
     is read-only (immutable); it's effectively frozen after construction.
     )
@@ -1829,8 +1829,8 @@ public template isCodepointSet(T)
 }
 
 /**
-    Tests if $(D T) is a pair of integers that implicitly convert to $(D V).
-    The following code must compile for any pair $(D T):
+    Tests if `T` is a pair of integers that implicitly convert to `V`.
+    The following code must compile for any pair `T`:
     ---
     (T x){ V a = x[0]; V b = x[1];}
     ---
@@ -1903,7 +1903,7 @@ pure:
 
 /**
     $(P
-    $(D InversionList) is a set of $(CODEPOINTS)
+    `InversionList` is a set of $(CODEPOINTS)
     represented as an array of open-right [a, b$(RPAREN)
     intervals (see $(LREF CodepointInterval) above).
     The name comes from the way the representation reads left to right.
@@ -1927,7 +1927,7 @@ pure:
     on $(LUCKY RLE encoding).
     )
 
-    $(P Sets are value types (just like $(D int) is) thus they
+    $(P Sets are value types (just like `int` is) thus they
         are never aliased.
     )
         Example:
@@ -1951,7 +1951,7 @@ pure:
 
     Note:
     $(P It's not recommended to rely on the template parameters
-    or the exact type of a current $(CODEPOINT) set in $(D std.uni).
+    or the exact type of a current $(CODEPOINT) set in `std.uni`.
     The type and parameters may change when the standard
     allocators design is finalized.
     Use $(LREF isCodepointSet) with templates or just stick with the default
@@ -2075,7 +2075,7 @@ public:
     }
 
     /**
-        Tests the presence of code point $(D val) in this set.
+        Tests the presence of code point `val` in this set.
 
         Example:
         ---
@@ -2093,7 +2093,7 @@ public:
         return sharSwitchLowerBound!"a<=b"(data[], val) & 1;
     }
 
-    // Linear scan for $(D ch). Useful only for small sets.
+    // Linear scan for `ch`. Useful only for small sets.
     // TODO:
     // used internally in std.regex
     // should be properly exposed in a public API ?
@@ -2221,7 +2221,7 @@ public:
     }
 
     /**
-        Tests the presence of codepoint $(D ch) in this set,
+        Tests the presence of codepoint `ch` in this set,
         the same as $(LREF opIndex).
     */
     bool opBinaryRight(string op: "in", U)(U ch) const
@@ -2301,7 +2301,7 @@ public:
 
     /**
         $(P Obtain textual representation of this set in from of
-        open-right intervals and feed it to $(D sink).
+        open-right intervals and feed it to `sink`.
         )
         $(P Used by various standard formatting facilities such as
          $(XREF _format, formattedWrite), $(XREF _stdio, write),
@@ -2497,7 +2497,7 @@ public:
 
     /**
         Generates string with D source code of unary function with name of
-        $(D funcName) taking a single $(D dchar) argument. If $(D funcName) is empty
+        `funcName` taking a single `dchar` argument. If `funcName` is empty
         the code is adjusted to be a lambda function.
 
         The function generated tests if the $(CODEPOINT) passed
@@ -3691,8 +3691,8 @@ auto arrayRepr(T)(T x)
 }
 
 /**
-    Maps $(D Key) to a suitable integer index within the range of $(D size_t).
-    The mapping is constructed by applying predicates from $(D Prefix) left to right
+    Maps `Key` to a suitable integer index within the range of $(D size_t).
+    The mapping is constructed by applying predicates from `Prefix` left to right
     and concatenating the resulting bits.
 
     The first (leftmost) predicate defines the most significant bits of
@@ -3716,7 +3716,7 @@ template mapTrieIndex(Prefix...)
 }
 
 /*
-    $(D TrieBuilder) is a type used for incremental construction
+    `TrieBuilder` is a type used for incremental construction
     of $(LREF Trie)s.
 
     See $(LREF buildTrie) for generic helpers built on top of it.
@@ -3944,7 +3944,7 @@ private:
 
 public:
     /**
-        Construct a builder, where $(D filler) is a value
+        Construct a builder, where `filler` is a value
         to indicate empty slots (or "not found" condition).
     */
     this(Value filler)
@@ -3961,9 +3961,9 @@ public:
     }
 
     /**
-        Put a value $(D v) into interval as
-        mapped by keys from $(D a) to $(D b).
-        All slots prior to $(D a) are filled with
+        Put a value `v` into interval as
+        mapped by keys from `a` to `b`.
+        All slots prior to `a` are filled with
         the default filler.
     */
     void putRange(Key a, Key b, Value v)
@@ -3975,8 +3975,8 @@ public:
     }
 
     /**
-        Put a value $(D v) into slot mapped by $(D key).
-        All slots prior to $(D key) are filled with the
+        Put a value `v` into slot mapped by `key`.
+        All slots prior to `key` are filled with the
         default filler.
     */
     void putValue(Key key, Value v)
@@ -4049,7 +4049,7 @@ public:
     }
 
     /*
-        $(P Lookup the $(D key) in this $(D Trie). )
+        $(P Lookup the `key` in this `Trie`. )
 
         $(P The lookup always succeeds if key fits the domain
         provided during construction. The whole domain defined
@@ -4057,7 +4057,7 @@ public:
         the sentinel (filler) value could be used. )
 
         $(P See $(LREF buildTrie), $(LREF TrieBuilder) for how to
-        define a domain of $(D Trie) keys and the sentinel value. )
+        define a domain of `Trie` keys and the sentinel value. )
 
         Note:
         Domain range-checking is only enabled in debug builds
@@ -4124,10 +4124,10 @@ template callableWith(T)
 }
 
 /*
-    Check if $(D Prefix) is a valid set of predicates
-    for $(D Trie) template having $(D Key) as the type of keys.
+    Check if `Prefix` is a valid set of predicates
+    for `Trie` template having `Key` as the type of keys.
     This requires all predicates to be callable, take
-    single argument of type $(D Key) and return unsigned value.
+    single argument of type `Key` and return unsigned value.
 */
 template isValidPrefixForTrie(Key, Prefix...)
 {
@@ -4135,8 +4135,8 @@ template isValidPrefixForTrie(Key, Prefix...)
 }
 
 /*
-    Check if $(D Args) is a set of maximum key value followed by valid predicates
-    for $(D Trie) template having $(D Key) as the type of keys.
+    Check if `Args` is a set of maximum key value followed by valid predicates
+    for `Trie` template having `Key` as the type of keys.
 */
 template isValidArgsForTrie(Key, Args...)
 {
@@ -4159,10 +4159,10 @@ template isValidArgsForTrie(Key, Args...)
 
 /**
     A shorthand for creating a custom multi-level fixed Trie
-    from a $(D CodepointSet). $(D sizes) are numbers of bits per level,
+    from a `CodepointSet`. `sizes` are numbers of bits per level,
     with the most significant bits used first.
 
-    Note: The sum of $(D sizes) must be equal 21.
+    Note: The sum of `sizes` must be equal 21.
 
     See_Also: $(LREF toTrie), which is even simpler.
 
@@ -4206,14 +4206,14 @@ public template CodepointSetTrie(sizes...)
 }
 
 /**
-    A slightly more general tool for building fixed $(D Trie)
+    A slightly more general tool for building fixed `Trie`
     for the Unicode data.
 
-    Specifically unlike $(D codepointSetTrie) it's allows creating mappings
-    of $(D dchar) to an arbitrary type $(D T).
+    Specifically unlike `codepointSetTrie` it's allows creating mappings
+    of `dchar` to an arbitrary type `T`.
 
-    Note: Overload taking $(D CodepointSet)s will naturally convert
-    only to bool mapping $(D Trie)s.
+    Note: Overload taking `CodepointSet`s will naturally convert
+    only to bool mapping `Trie`s.
 
     Example:
     ---
@@ -4364,15 +4364,15 @@ public template cmpK0(alias Pred)
 }
 
 /*
-    The most general utility for construction of $(D Trie)s
-    short of using $(D TrieBuilder) directly.
+    The most general utility for construction of `Trie`s
+    short of using `TrieBuilder` directly.
 
     Provides a number of convenience overloads.
-    $(D Args) is tuple of maximum key value followed by
+    `Args` is tuple of maximum key value followed by
     predicates to construct index from key.
 
-    Alternatively if the first argument is not a value convertible to $(D Key)
-    then the whole tuple of $(D Args) is treated as predicates
+    Alternatively if the first argument is not a value convertible to `Key`
+    then the whole tuple of `Args` is treated as predicates
     and the maximum Key is deduced from predicates.
 */
 public template buildTrie(Value, Key, Args...)
@@ -4398,7 +4398,7 @@ public template buildTrie(Value, Key, Args...)
     }
 
     /*
-        Build $(D Trie) from a range of a Key-Value pairs,
+        Build `Trie` from a range of a Key-Value pairs,
         assuming it is sorted by Key as defined by the following lambda:
         ------
         (a, b) => mapTrieIndex!(Prefix)(a) < mapTrieIndex!(Prefix)(b)
@@ -4406,7 +4406,7 @@ public template buildTrie(Value, Key, Args...)
         Exception is thrown if it's detected that the above order doesn't hold.
 
         In other words $(LREF mapTrieIndex) should be a
-        monotonically increasing function that maps $(D Key) to an integer.
+        monotonically increasing function that maps `Key` to an integer.
 
         See_Also: $(XREF _algorithm, sort),
         $(XREF _range, SortedRange),
@@ -4423,14 +4423,14 @@ public template buildTrie(Value, Key, Args...)
     }
 
     /*
-        If $(D Value) is bool (or BitPacked!(bool, x)) then it's possible
-        to build $(D Trie) from a range of open-right intervals of $(D Key)s.
+        If `Value` is bool (or BitPacked!(bool, x)) then it's possible
+        to build `Trie` from a range of open-right intervals of `Key`s.
         The requirement  on the ordering of keys (and the behavior on the
         violation of it) is the same as for Key-Value range overload.
 
-        Intervals denote ranges of !$(D filler) i.e. the opposite of filler.
+        Intervals denote ranges of !`filler` i.e. the opposite of filler.
         If no filler provided keys inside of the intervals map to true,
-        and $(D filler) is false.
+        and `filler` is false.
     */
     auto buildTrie(Range)(Range range, Value filler=Value.init)
         if(is(TypeOfBitPacked!Value ==  bool)
@@ -4456,13 +4456,13 @@ public template buildTrie(Value, Key, Args...)
     }
 
     /*
-        If $(D Value) is bool (or BitPacked!(bool, x)) then it's possible
-        to build $(D Trie) simply from an input range of $(D Key)s.
+        If `Value` is bool (or BitPacked!(bool, x)) then it's possible
+        to build `Trie` simply from an input range of `Key`s.
         The requirement  on the ordering of keys (and the behavior on the
         violation of it) is the same as for Key-Value range overload.
 
-        Keys found in range denote !$(D filler) i.e. the opposite of filler.
-        If no filler provided keys map to true, and $(D filler) is false.
+        Keys found in range denote !`filler` i.e. the opposite of filler.
+        If no filler provided keys map to true, and `filler` is false.
     */
     auto buildTrie(Range)(Range range, Value filler=Value.init)
         if(is(TypeOfBitPacked!Value ==  bool)
@@ -4475,7 +4475,7 @@ public template buildTrie(Value, Key, Args...)
     }
 
     /*
-        If $(D Key) is unsigned integer $(D Trie) could be constructed from array
+        If `Key` is unsigned integer `Trie` could be constructed from array
         of values where array index serves as key.
     */
     auto buildTrie()(Value[] array, Value filler=Value.init)
@@ -4488,7 +4488,7 @@ public template buildTrie(Value, Key, Args...)
     }
 
     /*
-        Builds $(D Trie) from associative array.
+        Builds `Trie` from associative array.
     */
     auto buildTrie(Key, Value)(Value[Key] map, Value filler=Value.init)
     {
@@ -4524,12 +4524,12 @@ public struct MatcherConcept
 {
     /**
         $(P Perform a semantic equivalent 2 operations:
-        decoding a $(CODEPOINT) at front of $(D inp) and testing if
+        decoding a $(CODEPOINT) at front of `inp` and testing if
         it belongs to the set of $(CODEPOINTS) of this matcher. )
 
-        $(P The effect on $(D inp) depends on the kind of function called:)
+        $(P The effect on `inp` depends on the kind of function called:)
 
-        $(P Match. If the codepoint is found in the set then range $(D inp)
+        $(P Match. If the codepoint is found in the set then range `inp`
         is advanced by its size in $(S_LINK Code unit, code units),
         otherwise the range is not modifed.)
 
@@ -4578,7 +4578,7 @@ public struct MatcherConcept
         Advanced feature - provide direct access to a subset of matcher based a
         set of known encoding lengths. Lengths are provided in
         $(S_LINK Code unit, code units). The sub-matcher then may do less
-        operations per any $(D test)/$(D match).
+        operations per any `test`/`match`.
 
         Use with care as the sub-matcher won't match
         any $(CODEPOINTS) that have encoded length that doesn't belong
@@ -4616,7 +4616,7 @@ public struct MatcherConcept
 }
 
 /**
-    Test if $(D M) is an UTF Matcher for ranges of $(D Char).
+    Test if `M` is an UTF Matcher for ranges of `Char`.
 */
 public enum isUtfMatcher(M, C) = __traits(compiles, (){
     C[] s;
@@ -5195,8 +5195,8 @@ private auto utf16Matcher(Set)(Set set) @trusted
 
 /**
     Constructs a matcher object
-    to classify $(CODEPOINTS) from the $(D set) for encoding
-    that has $(D Char) as code unit.
+    to classify $(CODEPOINTS) from the `set` for encoding
+    that has `Char` as code unit.
 
     See $(LREF MatcherConcept) for API outline.
 */
@@ -5242,7 +5242,7 @@ package auto decoder(C)(C[] s, size_t offset=0) @trusted
 }
 
 /*
-    Expose UTF string $(D s) as a random-access
+    Expose UTF string `s` as a random-access
     range of $(S_LINK Code unit, code units).
 */
 package auto units(C)(C[] s)
@@ -5407,9 +5407,9 @@ unittest
 
 /++
     Convenience function to construct optimal configurations for
-    packed Trie from any $(D set) of $(CODEPOINTS).
+    packed Trie from any `set` of $(CODEPOINTS).
 
-    The parameter $(D level) indicates the number of trie levels to use,
+    The parameter `level` indicates the number of trie levels to use,
     allowed values are: 1, 2, 3 or 4. Levels represent different trade-offs
     speed-size wise.
 
@@ -5420,7 +5420,7 @@ unittest
 
     Note:
     Level 4 stays very practical (being faster and more predictable)
-    compared to using direct lookup on the $(D set) itself.
+    compared to using direct lookup on the `set` itself.
 
 
 +/
@@ -5441,7 +5441,7 @@ public auto toTrie(size_t level, Set)(Set set)
 }
 
 /**
-    $(P Builds a $(D Trie) with typically optimal speed-size trade-off
+    $(P Builds a `Trie` with typically optimal speed-size trade-off
     and wraps it into a delegate of the following type:
     $(D bool delegate(dchar ch)). )
 
@@ -5461,15 +5461,15 @@ public auto toDelegate(Set)(Set set)
 /**
     $(P Opaque wrapper around unsigned built-in integers and
     code unit (char/wchar/dchar) types.
-    Parameter $(D sz) indicates that the value is confined
+    Parameter `sz` indicates that the value is confined
     to the range of [0, 2^^sz$(RPAREN). With this knowledge it can be
     packed more tightly when stored in certain
     data-structures like trie. )
 
     Note:
-    $(P The $(D BitPacked!(T, sz)) is implicitly convertible to $(D T)
+    $(P The $(D BitPacked!(T, sz)) is implicitly convertible to `T`
     but not vise-versa. Users have to ensure the value fits in
-    the range required and use the $(D cast)
+    the range required and use the `cast`
     operator to perform the conversion.)
 */
 struct BitPacked(T, size_t sz)
@@ -5481,7 +5481,7 @@ struct BitPacked(T, size_t sz)
 }
 
 /*
-    Depending on the form of the passed argument $(D bitSizeOf) returns
+    Depending on the form of the passed argument `bitSizeOf` returns
     the amount of bits required to represent a given type
     or a return type of a given functor.
 */
@@ -5504,7 +5504,7 @@ template bitSizeOf(Args...)
 }
 
 /**
-    Tests if $(D T) is some instantiation of $(LREF BitPacked)!(U, x)
+    Tests if `T` is some instantiation of $(LREF BitPacked)!(U, x)
     and thus suitable for packing.
 */
 template isBitPacked(T)
@@ -5516,8 +5516,8 @@ template isBitPacked(T)
 }
 
 /**
-    Gives the type $(D U) from $(LREF BitPacked)!(U, x)
-    or $(D T) itself for every other type.
+    Gives the type `U` from $(LREF BitPacked)!(U, x)
+    or `T` itself for every other type.
 */
 template TypeOfBitPacked(T)
 {
@@ -5528,9 +5528,9 @@ template TypeOfBitPacked(T)
 }
 
 /*
-    Wrapper, used in definition of custom data structures from $(D Trie) template.
+    Wrapper, used in definition of custom data structures from `Trie` template.
     Applying it to a unary lambda function indicates that the returned value always
-    fits within $(D bits) of bits.
+    fits within `bits` of bits.
 */
 struct assumeSize(alias Fn, size_t bits)
 {
@@ -5545,7 +5545,7 @@ struct assumeSize(alias Fn, size_t bits)
     A helper for defining lambda function that yields a slice
     of certain bits from an unsigned integral value.
     The resulting lambda is wrapped in assumeSize and can be used directly
-    with $(D Trie) template.
+    with `Trie` template.
 */
 struct sliceBits(size_t from, size_t to)
 {
@@ -5828,7 +5828,7 @@ unittest
     assert(equalS(decompressIntervals(compressIntervals(run2)), run2));
 }
 
-// Creates a range of $(D CodepointInterval) that lazily decodes compressed data.
+// Creates a range of `CodepointInterval` that lazily decodes compressed data.
 @safe package auto decompressIntervals(const(ubyte)[] data) pure
 {
     return DecompressedIntervals(data);
@@ -6082,8 +6082,8 @@ template SetSearcher(alias table, string kind)
 
         Note that since scripts and blocks overlap the
         usual trick to disambiguate is used - to get a block use
-        $(D unicode.InBlockName), to search a script
-        use $(D unicode.ScriptName).
+        `unicode.InBlockName`, to search a script
+        use `unicode.ScriptName`.
 
         See_Also: $(LREF block), $(LREF script)
         and (not included in this search) $(LREF hangulSyllableType).
@@ -6120,7 +6120,7 @@ template SetSearcher(alias table, string kind)
     /**
         The same lookup across blocks, scripts, or binary properties,
         but performed at run-time.
-        This version is provided for cases where $(D name)
+        This version is provided for cases where `name`
         is not known beforehand; otherwise compile-time
         checked $(LREF opDispatch) is typically a better choice.
 
@@ -6138,7 +6138,7 @@ template SetSearcher(alias table, string kind)
 
         Note:
         Here block names are unambiguous as no scripts are searched
-        and thus to search use simply $(D unicode.block.BlockName) notation.
+        and thus to search use simply `unicode.block.BlockName` notation.
 
         See $(S_LINK Unicode properties, table of properties) for available sets.
 
@@ -6183,8 +6183,8 @@ template SetSearcher(alias table, string kind)
         Fetch a set of $(CODEPOINTS) that have the given hangul syllable type.
 
         Other non-binary properties (once supported) follow the same
-        notation - $(D unicode.propertyName.propertyValue) for compile-time
-        checked access and $(D unicode.propertyName(propertyValue))
+        notation - `unicode.propertyName.propertyValue` for compile-time
+        checked access and `unicode.propertyName(propertyValue)`
         for run-time checked one.
 
         See the $(S_LINK Unicode properties, table of properties) for available
@@ -6421,8 +6421,8 @@ template genericDecodeGrapheme(bool getValue)
 public: // Public API continues
 
 /++
-    Returns the length of grapheme cluster starting at $(D index).
-    Both the resulting length and the $(D index) are measured
+    Returns the length of grapheme cluster starting at `index`.
+    Both the resulting length and the `index` are measured
     in $(S_LINK Code unit, code units).
 
     Example:
@@ -6459,12 +6459,12 @@ unittest
 }
 
 /++
-    Reads one full grapheme cluster from an input range of dchar $(D inp).
+    Reads one full grapheme cluster from an input range of dchar `inp`.
 
     For examples see the $(LREF Grapheme) below.
 
     Note:
-    This function modifies $(D inp) and thus $(D inp)
+    This function modifies `inp` and thus `inp`
     must be an L-value.
 +/
 Grapheme decodeGrapheme(Input)(ref Input inp)
@@ -6690,8 +6690,8 @@ unittest
     of a $(CLUSTER).
     )
 
-    $(P $(D Grapheme) has value semantics so 2 copies of a $(D Grapheme)
-    always refer to distinct objects. In most actual scenarios a $(D Grapheme)
+    $(P `Grapheme` has value semantics so 2 copies of a `Grapheme`
+    always refer to distinct objects. In most actual scenarios a `Grapheme`
     fits on the stack and avoids memory allocation overhead for all but quite
     long clusters.
     )
@@ -6742,7 +6742,7 @@ public:
     }
 
     /++
-        Writes a $(CODEPOINT) $(D ch) at given index in this cluster.
+        Writes a $(CODEPOINT) `ch` at given index in this cluster.
 
         Warning:
         Use of this facility may invalidate grapheme cluster,
@@ -6788,10 +6788,10 @@ public:
     }
 
     /++
-        Append $(CHARACTER) $(D ch) to this grapheme.
+        Append $(CHARACTER) `ch` to this grapheme.
         Warning:
         Use of this facility may invalidate grapheme cluster,
-        see also $(D valid).
+        see also `valid`.
 
         Example:
         ---
@@ -6837,7 +6837,7 @@ public:
             static assert(false, "No operation "~op~" defined for Grapheme");
     }
 
-    /// Append all $(CHARACTERS) from the input range $(D inp) to this Grapheme.
+    /// Append all $(CHARACTERS) from the input range `inp` to this Grapheme.
     ref opOpAssign(string op, Input)(Input inp)
         if(isInputRange!Input && is(ElementType!Input : dchar))
     {
@@ -6853,7 +6853,7 @@ public:
 
     /++
         True if this object contains valid extended grapheme cluster.
-        Decoding primitives of this module always return a valid $(D Grapheme).
+        Decoding primitives of this module always return a valid `Grapheme`.
 
         Appending to and direct manipulation of grapheme's $(CHARACTERS) may
         render it no longer valid. Certain applications may chose to use
@@ -7032,7 +7032,7 @@ unittest
 }
 
 /++
-    $(P Does basic case-insensitive comparison of strings $(D str1) and $(D str2).
+    $(P Does basic case-insensitive comparison of strings `str1` and `str2`.
     This function uses simpler comparison rule thus achieving better performance
     then $(LREF icmp). However keep in mind the warning below.)
 
@@ -7147,11 +7147,11 @@ private int fullCasedCmp(Range)(dchar lhs, dchar rhs, ref Range rtail)
 }
 
 /++
-    $(P Does case insensitive comparison of $(D str1) and $(D str2).
+    $(P Does case insensitive comparison of `str1` and `str2`.
     Follows the rules of full case-folding mapping.
     This includes matching as equal german ß with "ss" and
     other 1:M $(CODEPOINT) mappings unlike $(LREF sicmp).
-    The cost of $(D icmp) being pedantically correct is
+    The cost of `icmp` being pedantically correct is
     slightly worse performance.
     )
 
@@ -7247,7 +7247,7 @@ unittest
 // It needs a better API
 /*
     Return a range of all $(CODEPOINTS) that casefold to
-    and from this $(D ch).
+    and from this `ch`.
 */
 package auto simpleCaseFoldings(dchar ch)
 {
@@ -7342,7 +7342,7 @@ unittest
 }
 
 /++
-    $(P Returns the $(S_LINK Combining class, combining class) of $(D ch).)
+    $(P Returns the $(S_LINK Combining class, combining class) of `ch`.)
 
     Example:
     ---
@@ -7397,11 +7397,11 @@ enum {
     Try to canonically compose 2 $(CHARACTERS).
     Returns the composed $(CHARACTER) if they do compose and dchar.init otherwise.
 
-    The assumption is that $(D first) comes before $(D second) in the original text,
+    The assumption is that `first` comes before `second` in the original text,
     usually meaning that the first is a starter.
 
     Note: Hangul syllables are not covered by this function.
-    See $(D composeJamo) below.
+    See `composeJamo` below.
 
     Example:
     ---
@@ -7437,9 +7437,9 @@ public dchar compose(dchar first, dchar second) pure nothrow
 /++
     Returns a full $(S_LINK Canonical decomposition, Canonical)
     (by default) or $(S_LINK Compatibility decomposition, Compatibility)
-    decomposition of $(CHARACTER) $(D ch).
+    decomposition of $(CHARACTER) `ch`.
     If no decomposition is available returns a $(LREF Grapheme)
-    with the $(D ch) itself.
+    with the `ch` itself.
 
     Note:
     This function also decomposes hangul syllables
@@ -7506,14 +7506,14 @@ enum jamoLCount = 19, jamoVCount = 21, jamoTCount = 28;
 enum jamoNCount = jamoVCount * jamoTCount;
 enum jamoSCount = jamoLCount * jamoNCount;
 
-// Tests if $(D ch) is a Hangul leading consonant jamo.
+// Tests if `ch` is a Hangul leading consonant jamo.
 bool isJamoL(dchar ch) pure nothrow @nogc
 {
     // first cmp rejects ~ 1M code points above leading jamo range
     return ch < jamoLBase+jamoLCount && ch >= jamoLBase;
 }
 
-// Tests if $(D ch) is a Hangul vowel jamo.
+// Tests if `ch` is a Hangul vowel jamo.
 bool isJamoT(dchar ch) pure nothrow @nogc
 {
     // first cmp rejects ~ 1M code points above trailing jamo range
@@ -7521,7 +7521,7 @@ bool isJamoT(dchar ch) pure nothrow @nogc
     return ch < jamoTBase+jamoTCount && ch > jamoTBase;
 }
 
-// Tests if $(D ch) is a Hangul trailnig consonant jamo.
+// Tests if `ch` is a Hangul trailnig consonant jamo.
 bool isJamoV(dchar ch) pure nothrow @nogc
 {
     // first cmp rejects ~ 1M code points above vowel range
@@ -7567,8 +7567,8 @@ void hangulRecompose(dchar[] seq) pure nothrow @nogc
 public:
 
 /**
-    Decomposes a Hangul syllable. If $(D ch) is not a composed syllable
-    then this function returns $(LREF Grapheme) containing only $(D ch) as is.
+    Decomposes a Hangul syllable. If `ch` is not a composed syllable
+    then this function returns $(LREF Grapheme) containing only `ch` as is.
 
     Example:
     ---
@@ -7593,12 +7593,12 @@ Grapheme decomposeHangul(dchar ch)
 }
 
 /++
-    Try to compose hangul syllable out of a leading consonant ($(D lead)),
-    a $(D vowel) and optional $(D trailing) consonant jamos.
+    Try to compose hangul syllable out of a leading consonant (`lead`),
+    a `vowel` and optional `trailing` consonant jamos.
 
     On success returns the composed LV or LVT hangul syllable.
 
-    If any of $(D lead) and $(D vowel) are not a valid hangul jamo
+    If any of `lead` and `vowel` are not a valid hangul jamo
     of the respective $(CHARACTER) class returns dchar.init.
 
     Example:
@@ -7674,7 +7674,7 @@ enum {
 };
 
 /++
-    Returns $(D input) string normalized to the chosen form.
+    Returns `input` string normalized to the chosen form.
     Form C is used by default.
 
     For more information on normalization forms see
@@ -7930,8 +7930,8 @@ private auto seekStable(NormalizationForm norm, C)(size_t idx, in C[] input)
 }
 
 /**
-    Tests if dchar $(D ch) is always allowed (Quick_Check=YES) in normalization
-    form $(D norm).
+    Tests if dchar `ch` is always allowed (Quick_Check=YES) in normalization
+    form `norm`.
     ---
     // e.g. Cyrillic is always allowed, so is ASCII
     assert(allowedIn!NFC('я'));
@@ -8010,7 +8010,7 @@ else
 public:
 
 /++
-    Whether or not $(D c) is a Unicode whitespace $(CHARACTER).
+    Whether or not `c` is a Unicode whitespace $(CHARACTER).
     (general Unicode category: Part of C0(tab, vertical tab, form feed,
     carriage return, and linefeed characters), Zs, Zl, Zp, and NEL(U+0085))
 +/
@@ -8021,7 +8021,7 @@ public bool isWhite(dchar c)
 }
 
 /++
-    Return whether $(D c) is a Unicode lowercase $(CHARACTER).
+    Return whether `c` is a Unicode lowercase $(CHARACTER).
 +/
 @safe pure nothrow @nogc
 bool isLower(dchar c)
@@ -8054,7 +8054,7 @@ bool isLower(dchar c)
 
 
 /++
-    Return whether $(D c) is a Unicode uppercase $(CHARACTER).
+    Return whether `c` is a Unicode uppercase $(CHARACTER).
 +/
 @safe pure nothrow @nogc
 bool isUpper(dchar c)
@@ -8086,8 +8086,8 @@ bool isUpper(dchar c)
 
 
 /++
-    If $(D c) is a Unicode uppercase $(CHARACTER), then its lowercase equivalent
-    is returned. Otherwise $(D c) is returned.
+    If `c` is a Unicode uppercase $(CHARACTER), then its lowercase equivalent
+    is returned. Otherwise `c` is returned.
 
     Warning: certain alphabets like German and Greek have no 1:1
     upper-lower mapping. Use overload of toLower which takes full string instead.
@@ -8433,10 +8433,10 @@ private template toCaseInPlaceAlloc(alias indexFn, uint maxIdx, alias tableFn)
 }
 
 /++
-    Converts $(D s) to lowercase (by performing Unicode lowercase mapping) in place.
+    Converts `s` to lowercase (by performing Unicode lowercase mapping) in place.
     For a few characters string length may increase after the transformation,
     in such a case the function reallocates exactly once.
-    If $(D s) does not have any uppercase characters, then $(D s) is unaltered.
+    If `s` does not have any uppercase characters, then `s` is unaltered.
 +/
 void toLowerInPlace(C)(ref C[] s) @trusted pure
     if (is(C == char) || is(C == wchar) || is(C == dchar))
@@ -8455,10 +8455,10 @@ void toLowerInPlace(C)(ref C[] s) @trusted pure
 }
 
 /++
-    Converts $(D s) to uppercase  (by performing Unicode uppercase mapping) in place.
+    Converts `s` to uppercase  (by performing Unicode uppercase mapping) in place.
     For a few characters string length may increase after the transformation,
     in such a case the function reallocates exactly once.
-    If $(D s) does not have any lowercase characters, then $(D s) is unaltered.
+    If `s` does not have any lowercase characters, then `s` is unaltered.
 +/
 void toUpperInPlace(C)(ref C[] s) @trusted pure
     if (is(C == char) || is(C == wchar) || is(C == dchar))
@@ -8477,9 +8477,9 @@ void toUpperInPlace(C)(ref C[] s) @trusted pure
 }
 
 /++
-    Returns a string which is identical to $(D s) except that all of its
+    Returns a string which is identical to `s` except that all of its
     characters are converted to lowercase (by preforming Unicode lowercase mapping).
-    If none of $(D s) characters were affected, then $(D s) itself is returned.
+    If none of `s` characters were affected, then `s` itself is returned.
 +/
 S toLower(S)(S s) @trusted pure
     if(isSomeString!S)
@@ -8578,8 +8578,8 @@ unittest
 
 
 /++
-    If $(D c) is a Unicode lowercase $(CHARACTER), then its uppercase equivalent
-    is returned. Otherwise $(D c) is returned.
+    If `c` is a Unicode lowercase $(CHARACTER), then its uppercase equivalent
+    is returned. Otherwise `c` is returned.
 
     Warning:
     Certain alphabets like German and Greek have no 1:1
@@ -8639,9 +8639,9 @@ unittest
 }
 
 /++
-    Returns a string which is identical to $(D s) except that all of its
+    Returns a string which is identical to `s` except that all of its
     characters are converted to uppercase (by preforming Unicode uppercase mapping).
-    If none of $(D s) characters were affected, then $(D s) itself is returned.
+    If none of `s` characters were affected, then `s` itself is returned.
 +/
 S toUpper(S)(S s) @trusted pure
     if(isSomeString!S)
@@ -8747,7 +8747,7 @@ unittest
 
 
 /++
-    Returns whether $(D c) is a Unicode alphabetic $(CHARACTER)
+    Returns whether `c` is a Unicode alphabetic $(CHARACTER)
     (general Unicode category: Alphabetic).
 +/
 @safe pure nothrow @nogc
@@ -8782,7 +8782,7 @@ bool isAlpha(dchar c)
 
 
 /++
-    Returns whether $(D c) is a Unicode mark
+    Returns whether `c` is a Unicode mark
     (general Unicode category: Mn, Me, Mc).
 +/
 @safe pure nothrow @nogc
@@ -8801,7 +8801,7 @@ bool isMark(dchar c)
 }
 
 /++
-    Returns whether $(D c) is a Unicode numerical $(CHARACTER)
+    Returns whether `c` is a Unicode numerical $(CHARACTER)
     (general Unicode category: Nd, Nl, No).
 +/
 @safe pure nothrow @nogc
@@ -8821,7 +8821,7 @@ bool isNumber(dchar c)
 
 
 /++
-    Returns whether $(D c) is a Unicode punctuation $(CHARACTER)
+    Returns whether `c` is a Unicode punctuation $(CHARACTER)
     (general Unicode category: Pd, Ps, Pe, Pc, Po, Pi, Pf).
 +/
 @safe pure nothrow @nogc
@@ -8844,7 +8844,7 @@ unittest
 }
 
 /++
-    Returns whether $(D c) is a Unicode symbol $(CHARACTER)
+    Returns whether `c` is a Unicode symbol $(CHARACTER)
     (general Unicode category: Sm, Sc, Sk, So).
 +/
 @safe pure nothrow @nogc
@@ -8865,7 +8865,7 @@ unittest
 }
 
 /++
-    Returns whether $(D c) is a Unicode space $(CHARACTER)
+    Returns whether `c` is a Unicode space $(CHARACTER)
     (general Unicode category: Zs)
     Note: This doesn't include '\n', '\r', \t' and other non-space $(CHARACTER).
     For commonly used less strict semantics see $(LREF isWhite).
@@ -8888,7 +8888,7 @@ unittest
 
 
 /++
-    Returns whether $(D c) is a Unicode graphical $(CHARACTER)
+    Returns whether `c` is a Unicode graphical $(CHARACTER)
     (general Unicode category: L, M, N, P, S, Zs).
 
 +/
@@ -8911,7 +8911,7 @@ unittest
 
 
 /++
-    Returns whether $(D c) is a Unicode control $(CHARACTER)
+    Returns whether `c` is a Unicode control $(CHARACTER)
     (general Unicode category: Cc).
 +/
 @safe pure nothrow @nogc
@@ -8934,7 +8934,7 @@ unittest
 
 
 /++
-    Returns whether $(D c) is a Unicode formatting $(CHARACTER)
+    Returns whether `c` is a Unicode formatting $(CHARACTER)
     (general Unicode category: Cf).
 +/
 @safe pure nothrow @nogc
@@ -8955,7 +8955,7 @@ unittest
 // if need be they can be generated from unicode data as well
 
 /++
-    Returns whether $(D c) is a Unicode Private Use $(CODEPOINT)
+    Returns whether `c` is a Unicode Private Use $(CODEPOINT)
     (general Unicode category: Co).
 +/
 @safe pure nothrow @nogc
@@ -8967,7 +8967,7 @@ bool isPrivateUse(dchar c)
 }
 
 /++
-    Returns whether $(D c) is a Unicode surrogate $(CODEPOINT)
+    Returns whether `c` is a Unicode surrogate $(CODEPOINT)
     (general Unicode category: Cs).
 +/
 @safe pure nothrow @nogc
@@ -8977,7 +8977,7 @@ bool isSurrogate(dchar c)
 }
 
 /++
-    Returns whether $(D c) is a Unicode high surrogate (lead surrogate).
+    Returns whether `c` is a Unicode high surrogate (lead surrogate).
 +/
 @safe pure nothrow @nogc
 bool isSurrogateHi(dchar c)
@@ -8986,7 +8986,7 @@ bool isSurrogateHi(dchar c)
 }
 
 /++
-    Returns whether $(D c) is a Unicode low surrogate (trail surrogate).
+    Returns whether `c` is a Unicode low surrogate (trail surrogate).
 +/
 @safe pure nothrow @nogc
 bool isSurrogateLo(dchar c)
@@ -8995,7 +8995,7 @@ bool isSurrogateLo(dchar c)
 }
 
 /++
-    Returns whether $(D c) is a Unicode non-character i.e.
+    Returns whether `c` is a Unicode non-character i.e.
     a $(CODEPOINT) with no assigned abstract character.
     (general Unicode category: Cn)
 +/
diff --git a/std/utf.d b/std/utf.d
index 2b0642c19a7..420b031bafb 100644
--- a/std/utf.d
+++ b/std/utf.d
@@ -85,9 +85,9 @@ class UTFException : Exception
 
 
 /++
-    Returns whether $(D c) is a valid UTF-32 character.
+    Returns whether `c` is a valid UTF-32 character.
 
-    $(D '\uFFFE') and $(D '\uFFFF') are considered valid by $(D isValidDchar),
+    `'\uFFFE'` and `'\uFFFF'` are considered valid by `isValidDchar`,
     as they are permitted for internal use by an application, but they are
     not allowed for interchange by the Unicode standard.
   +/
@@ -128,25 +128,25 @@ unittest
 
 
 /++
-    $(D stride) returns the length of the UTF-8 sequence starting at $(D index)
-    in $(D str).
+    `stride` returns the length of the UTF-8 sequence starting at `index`
+    in `str`.
 
-    $(D stride) works with both UTF-8 strings and ranges of $(D char). If no
+    `stride` works with both UTF-8 strings and ranges of `char`. If no
     index is passed, then an input range will work, but if an index is passed,
     then a random-access range is required.
 
-    $(D index) defaults to $(D 0) if none is passed.
+    `index` defaults to `0` if none is passed.
 
     Returns:
         The number of bytes in the UTF-8 sequence, a value between 1 and 4
         (as per $(WEB tools.ietf.org/html/rfc3629#section-3, RFC 3629$(COMMA) section 3)).
 
     Throws:
-        May throw a $(D UTFException) if $(D str[index]) is not the start of a
+        May throw a `UTFException` if `str[index]` is not the start of a
         valid UTF-8 sequence.
 
     Notes:
-        $(D stride) will only analyze the first $(D str[index]) element. It
+        `stride` will only analyze the first `str[index]` element. It
         will not fully verify the validity of UTF-8 sequence, nor even verify
         the presence of the sequence: it will not actually guarantee that
         $(D index + stride(str, index) <= str.length).
@@ -275,24 +275,24 @@ unittest // invalid start bytes
 
 
 /++
-    $(D strideBack) returns the length of the UTF-8 sequence ending one code
-    unit before $(D index) in $(D str).
+    `strideBack` returns the length of the UTF-8 sequence ending one code
+    unit before `index` in `str`.
 
-    $(D strideBack) works with both UTF-8 strings and bidirectional ranges of
-    $(D char). If no index is passed, then a bidirectional range will work, but
+    `strideBack` works with both UTF-8 strings and bidirectional ranges of
+    `char`. If no index is passed, then a bidirectional range will work, but
     if an index is passed, then a random-access range is required.
 
-    $(D index) defaults to $(D str.length) if none is passed.
+    `index` defaults to `str.length` if none is passed.
 
     Returns:
         The number of bytes in the UTF-8 sequence.
 
     Throws:
-        May throw a $(D UTFException) if $(D str[index]) is not one past the
+        May throw a `UTFException` if `str[index]` is not one past the
         end of a valid UTF-8 sequence.
 
     Notes:
-        $(D strideBack) will not fully verify the validity of the UTF-8
+        `strideBack` will not fully verify the validity of the UTF-8
         sequence. It will, however, guarantee that
         $(D index - stride(str, index)) is a valid index.
   +/
@@ -419,24 +419,24 @@ unittest
 
 
 /++
-    $(D stride) returns the length of the UTF-16 sequence starting at $(D index)
-    in $(D str).
+    `stride` returns the length of the UTF-16 sequence starting at `index`
+    in `str`.
 
-    $(D stride) works with both UTF-16 strings and ranges of $(D wchar). If no
+    `stride` works with both UTF-16 strings and ranges of `wchar`. If no
     index is passed, then an input range will work, but if an index is passed,
     then a random-access range is required.
 
-    $(D index) defaults to $(D 0) if none is passed.
+    `index` defaults to `0` if none is passed.
 
     Returns:
         The number of bytes in the UTF-16 sequence.
 
     Throws:
-        May throw a $(D UTFException) if $(D str[index]) is not the start of a
+        May throw a `UTFException` if `str[index]` is not the start of a
         valid UTF-16 sequence.
 
     Notes:
-        $(D stride) will only analyze the first $(D str[index]) element. It
+        `stride` will only analyze the first `str[index]` element. It
         will not fully verify the validity of UTF-16 sequence, nor even verify
         the presence of the sequence: it will not actually guarantee that
         $(D index + stride(str, index) <= str.length).
@@ -535,24 +535,24 @@ uint stride(S)(auto ref S str)
 
 
 /++
-    $(D strideBack) returns the length of the UTF-16 sequence ending one code
-    unit before $(D index) in $(D str).
+    `strideBack` returns the length of the UTF-16 sequence ending one code
+    unit before `index` in `str`.
 
-    $(D strideBack) works with both UTF-16 strings and ranges of $(D wchar). If
+    `strideBack` works with both UTF-16 strings and ranges of `wchar`. If
     no index is passed, then a bidirectional range will work, but if an index is
     passed, then a random-access range is required.
 
-    $(D index) defaults to $(D str.length) if none is passed.
+    `index` defaults to `str.length` if none is passed.
 
     Returns:
         The number of bytes in the UTF-16 sequence.
 
     Throws:
-        May throw a $(D UTFException) if $(D str[index]) is not one past the
+        May throw a `UTFException` if `str[index]` is not one past the
         end of a valid UTF-16 sequence.
 
     Notes:
-        $(D stride) will only analyze the element at $(D str[index - 1])
+        `stride` will only analyze the element at $(D str[index - 1])
         element. It will not fully verify the validity of UTF-16 sequence, nor
         even verify the presence of the sequence: it will not actually
         guarantee that $(D stride(str, index) <= index).
@@ -655,13 +655,13 @@ unittest
 
 
 /++
-    $(D stride) returns the length of the UTF-32 sequence starting at $(D index)
-    in $(D str).
+    `stride` returns the length of the UTF-32 sequence starting at `index`
+    in `str`.
 
-    $(D stride) works with both UTF-32 strings and ranges of $(D dchar).
+    `stride` works with both UTF-32 strings and ranges of `dchar`.
 
     Returns:
-        The number of bytes in the UTF-32 sequence (always $(D 1)).
+        The number of bytes in the UTF-32 sequence (always `1`).
 
     Throws:
         Never.
@@ -746,17 +746,17 @@ unittest
 
 
 /++
-    $(D strideBack) returns the length of the UTF-32 sequence ending one code
-    unit before $(D index) in $(D str).
+    `strideBack` returns the length of the UTF-32 sequence ending one code
+    unit before `index` in `str`.
 
-    $(D strideBack) works with both UTF-32 strings and ranges of $(D dchar). If
+    `strideBack` works with both UTF-32 strings and ranges of `dchar`. If
     no index is passed, then a bidirectional range will work, but if an index is
     passed, then a random-access range is required.
 
-    $(D index) defaults to $(D str.length) if none is passed.
+    `index` defaults to `str.length` if none is passed.
 
     Returns:
-        The number of bytes in the UTF-32 sequence (always $(D 1)).
+        The number of bytes in the UTF-32 sequence (always `1`).
 
     Throws:
         Never.
@@ -847,9 +847,9 @@ unittest
 
 
 /++
-    Given $(D index) into $(D str) and assuming that $(D index) is at the start
-    of a UTF sequence, $(D toUCSindex) determines the number of UCS characters
-    up to $(D index). So, $(D index) is the index of a code unit at the
+    Given `index` into `str` and assuming that `index` is at the start
+    of a UTF sequence, `toUCSindex` determines the number of UCS characters
+    up to `index`. So, `index` is the index of a code unit at the
     beginning of a code point, and the return value is how many code points into
     the string that that code point is.
   +/
@@ -896,8 +896,8 @@ unittest
 
 
 /++
-    Given a UCS index $(D n) into $(D str), returns the UTF index.
-    So, $(D n) is how many code points into the string the code point is, and
+    Given a UCS index `n` into `str`, returns the UTF index.
+    So, `n` is how many code points into the string the code point is, and
     the array index of the code unit is returned.
   +/
 size_t toUTFindex(C)(const(C)[] str, size_t n) @safe pure
@@ -938,9 +938,9 @@ unittest
 /* =================== Decode ======================= */
 
 /++
-    Decodes and returns the code point starting at $(D str[index]). $(D index)
+    Decodes and returns the code point starting at `str[index]`. `index`
     is advanced to one past the decoded code point. If the code point is not
-    well-formed, then a $(D UTFException) is thrown and $(D index) remains
+    well-formed, then a `UTFException` is thrown and `index` remains
     unchanged.
 
     decode will only work with strings and random access ranges of code units
@@ -948,7 +948,7 @@ unittest
     input range of code units.
 
     Throws:
-        $(LREF UTFException) if $(D str[index]) is not the start of a valid UTF
+        $(LREF UTFException) if `str[index]` is not the start of a valid UTF
         sequence.
   +/
 dchar decode(S)(auto ref S str, ref size_t index)
@@ -989,15 +989,15 @@ body
 }
 
 /++
-    $(D decodeFront) is a variant of $(LREF decode) which specifically decodes
-    the first code point. Unlike $(LREF decode), $(D decodeFront) accepts any
+    `decodeFront` is a variant of $(LREF decode) which specifically decodes
+    the first code point. Unlike $(LREF decode), `decodeFront` accepts any
     input range of code units (rather than just a string or random access
-    range). It also takes the range by $(D ref) and pops off the elements as it
-    decodes them. If $(D numCodeUnits) is passed in, it gets set to the number
+    range). It also takes the range by `ref` and pops off the elements as it
+    decodes them. If `numCodeUnits` is passed in, it gets set to the number
     of code units which were in the code point which was decoded.
 
     Throws:
-        $(LREF UTFException) if $(D str.front) is not the start of a valid UTF
+        $(LREF UTFException) if `str.front` is not the start of a valid UTF
         sequence. If an exception is thrown, then there is no guarantee as to
         the number of code units which were popped off, as it depends on the
         type of range being used and how many code units had to be popped off
@@ -1597,13 +1597,13 @@ unittest
 /* =================== Encode ======================= */
 
 /++
-    Encodes $(D c) into the static array, $(D buf), and returns the actual
-    length of the encoded character (a number between $(D 1) and $(D 4) for
-    $(D char[4]) buffers and a number between $(D 1) and $(D 2) for
-    $(D wchar[2]) buffers).
+    Encodes `c` into the static array, `buf`, and returns the actual
+    length of the encoded character (a number between `1` and `4` for
+    `char[4]` buffers and a number between `1` and `2` for
+    `wchar[2]` buffers).
 
     Throws:
-        $(D UTFException) if $(D c) is not a valid UTF code point.
+        `UTFException` if `c` is not a valid UTF code point.
   +/
 size_t encode(ref char[4] buf, dchar c) @safe pure
 {
@@ -1722,10 +1722,10 @@ unittest
 
 
 /++
-    Encodes $(D c) in $(D str)'s encoding and appends it to $(D str).
+    Encodes `c` in `str`'s encoding and appends it to `str`.
 
     Throws:
-        $(D UTFException) if $(D c) is not a valid UTF code point.
+        `UTFException` if `c` is not a valid UTF code point.
   +/
 void encode(ref char[] str, dchar c) @safe pure
 {
@@ -1917,7 +1917,7 @@ unittest
 
 /++
     Returns the number of code units that are required to encode the code point
-    $(D c) when $(D C) is the character type used to encode it.
+    `c` when `C` is the character type used to encode it.
   +/
 ubyte codeLength(C)(dchar c) @safe pure nothrow @nogc
     if (isSomeChar!C)
@@ -1955,8 +1955,8 @@ pure nothrow @nogc unittest
 
 
 /++
-    Returns the number of code units that are required to encode $(D str)
-    in a string whose character type is $(D C). This is particularly useful
+    Returns the number of code units that are required to encode `str`
+    in a string whose character type is `C`. This is particularly useful
     when slicing one string with the length of another and the two string
     types use different character types.
   +/
@@ -2029,11 +2029,11 @@ unittest
 /+
 Internal helper function:
 
-Returns true if it is safe to search for the Codepoint $(D c) inside
+Returns true if it is safe to search for the Codepoint `c` inside
 code units, without decoding.
 
 This is a runtime check that is used an optimization in various functions,
-particularly, in $(D std.string).
+particularly, in `std.string`.
   +/
 package bool canSearchInCodeUnits(C)(dchar c)
 if (isSomeChar!C)
@@ -2069,10 +2069,10 @@ unittest
 /* =================== Validation ======================= */
 
 /++
-    Checks to see if $(D str) is well-formed unicode or not.
+    Checks to see if `str` is well-formed unicode or not.
 
     Throws:
-        $(D UTFException) if $(D str) is not well-formed.
+        `UTFException` if `str` is not well-formed.
   +/
 void validate(S)(in S str) @safe pure
     if (isSomeString!S)
@@ -2228,7 +2228,7 @@ body
 }
 
 /****************
- * Encodes string $(D s) into UTF-16 and returns the encoded string.
+ * Encodes string `s` into UTF-16 and returns the encoded string.
  */
 wstring toUTF16(in char[] s) @trusted
 {
@@ -2346,36 +2346,36 @@ dstring toUTF32(in dchar[] s) @safe
 /* =================== toUTFz ======================= */
 
 /++
-    Returns a C-style zero-terminated string equivalent to $(D str). $(D str)
-    must not contain embedded $(D '\0')'s as any C function will treat the first
-    $(D '\0') that it sees as the end of the string. If $(D str.empty) is
-    $(D true), then a string containing only $(D '\0') is returned.
+    Returns a C-style zero-terminated string equivalent to `str`. `str`
+    must not contain embedded `'\0'`'s as any C function will treat the first
+    `'\0'` that it sees as the end of the string. If `str.empty` is
+    `true`, then a string containing only `'\0'` is returned.
 
-    $(D toUTFz) accepts any type of string and is templated on the type of
+    `toUTFz` accepts any type of string and is templated on the type of
     character pointer that you wish to convert to. It will avoid allocating a
     new string if it can, but there's a decent chance that it will end up having
     to allocate a new string - particularly when dealing with character types
-    other than $(D char).
+    other than `char`.
 
-    $(RED Warning 1:) If the result of $(D toUTFz) equals $(D str.ptr), then if
-    anything alters the character one past the end of $(D str) (which is the
-    $(D '\0') character terminating the string), then the string won't be
+    $(RED Warning 1:) If the result of `toUTFz` equals `str.ptr`, then if
+    anything alters the character one past the end of `str` (which is the
+    `'\0'` character terminating the string), then the string won't be
     zero-terminated anymore. The most likely scenarios for that are if you
-    append to $(D str) and no reallocation takes place or when $(D str) is a
+    append to `str` and no reallocation takes place or when `str` is a
     slice of a larger array, and you alter the character in the larger array
-    which is one character past the end of $(D str). Another case where it could
+    which is one character past the end of `str`. Another case where it could
     occur would be if you had a mutable character array immediately after
-    $(D str) in memory (for example, if they're member variables in a
+    `str` in memory (for example, if they're member variables in a
     user-defined type with one declared right after the other) and that
-    character array happened to start with $(D '\0'). Such scenarios will never
+    character array happened to start with `'\0'`. Such scenarios will never
     occur if you immediately use the zero-terminated string after calling
-    $(D toUTFz) and the C function using it doesn't keep a reference to it.
+    `toUTFz` and the C function using it doesn't keep a reference to it.
     Also, they are unlikely to occur even if you save the zero-terminated string
     (the cases above would be among the few examples of where it could happen).
     However, if you save the zero-terminate string and want to be absolutely
     certain that the string stays zero-terminated, then simply append a
-    $(D '\0') to the string and use its $(D ptr) property rather than calling
-    $(D toUTFz).
+    `'\0'` to the string and use its `ptr` property rather than calling
+    `toUTFz`.
 
     $(RED Warning 2:) When passing a character pointer to a C function, and the
     C function keeps it around for any reason, make sure that you keep a
@@ -2589,11 +2589,11 @@ private P toUTFzImpl(P, S)(S str) @safe pure
 
 
 /++
-    $(D toUTF16z) is a convenience function for $(D toUTFz!(const(wchar)*)).
+    `toUTF16z` is a convenience function for $(D toUTFz!(const(wchar)*)).
 
-    Encodes string $(D s) into UTF-16 and returns the encoded string.
-    $(D toUTF16z) is suitable for calling the 'W' functions in the Win32 API
-    that take an $(D LPWSTR) or $(D LPCWSTR) argument.
+    Encodes string `s` into UTF-16 and returns the encoded string.
+    `toUTF16z` is suitable for calling the 'W' functions in the Win32 API
+    that take an `LPWSTR` or `LPCWSTR` argument.
   +/
 const(wchar)* toUTF16z(C)(const(C)[] str) @safe pure
     if (isSomeChar!C)
@@ -2645,14 +2645,14 @@ pure unittest
 
 
 /++
-    Returns the total number of code points encoded in $(D str).
+    Returns the total number of code points encoded in `str`.
 
     Supercedes: This function supercedes $(LREF toUCSindex).
 
     Standards: Unicode 5.0, ASCII, ISO-8859-1, WINDOWS-1252
 
     Throws:
-        $(D UTFException) if $(D str) is not well-formed.
+        `UTFException` if `str` is not well-formed.
   +/
 size_t count(C)(const(C)[] str) @trusted pure nothrow @nogc
     if (isSomeChar!C)
diff --git a/std/uuid.d b/std/uuid.d
index dc0acab2357..bba712591de 100644
--- a/std/uuid.d
+++ b/std/uuid.d
@@ -50,7 +50,7 @@ $(MYREF oidNamespace) $(MYREF x500Namespace) )
  *
  * For efficiency, UUID is implemented as a struct. UUIDs are therefore empty if not explicitly
  * initialized. An UUID is empty if $(MYREF3 UUID.empty, empty) is true. Empty UUIDs are equal to
- * $(D UUID.init), which is a UUID with all 16 bytes set to 0.
+ * `UUID.init`, which is a UUID with all 16 bytes set to 0.
  * Use UUID's constructors or the UUID generator functions to get an initialized UUID.
  *
  * This is a port of $(LINK2 http://www.boost.org/doc/libs/1_42_0/libs/uuid/uuid.html,
@@ -171,7 +171,7 @@ public struct UUID
          *
          * Note:
          * All of these UUID versions can be read and processed by
-         * $(D std.uuid), but only version 3, 4 and 5 UUIDs can be generated.
+         * `std.uuid`, but only version 3, 4 and 5 UUIDs can be generated.
          */
         enum Version
         {
@@ -809,7 +809,7 @@ public struct UUID
 
 /**
  * This function generates a name based (Version 3) UUID from a namespace UUID and a name.
- * If no namespace UUID was passed, the empty UUID $(D UUID.init) is used.
+ * If no namespace UUID was passed, the empty UUID `UUID.init` is used.
  *
  * Note:
  * The default namespaces ($(LREF dnsNamespace), ...) defined by
@@ -835,8 +835,8 @@ public struct UUID
  * RFC 4122 isn't very clear on how UUIDs should be generated from names.
  * It is possible that different implementations return different UUIDs
  * for the same input, so be warned. The implementation for UTF-8 strings
- * and byte arrays used by $(D std.uuid) is compatible with Boost's implementation.
- * $(D std.uuid) guarantees that the same input to this function will generate
+ * and byte arrays used by `std.uuid` is compatible with Boost's implementation.
+ * `std.uuid` guarantees that the same input to this function will generate
  * the same output at any time, on any system (this especially means endianness
  * doesn't matter).
  *
@@ -924,7 +924,7 @@ public struct UUID
  /**
  * This function generates a name based (Version 5) UUID from a namespace
  * UUID and a name.
- * If no namespace UUID was passed, the empty UUID $(D UUID.init) is used.
+ * If no namespace UUID was passed, the empty UUID `UUID.init` is used.
  *
  * Note:
  * The default namespaces ($(LREF dnsNamespace), ...) defined by
@@ -947,8 +947,8 @@ public struct UUID
  * RFC 4122 isn't very clear on how UUIDs should be generated from names.
  * It is possible that different implementations return different UUIDs
  * for the same input, so be warned. The implementation for UTF-8 strings
- * and byte arrays used by $(D std.uuid) is compatible with Boost's implementation.
- * $(D std.uuid) guarantees that the same input to this function will generate
+ * and byte arrays used by `std.uuid` is compatible with Boost's implementation.
+ * `std.uuid` guarantees that the same input to this function will generate
  * the same output at any time, on any system (this especially means endianness
  * doesn't matter).
  *
diff --git a/std/variant.d b/std/variant.d
index 6d8cb236c76..4c25dc3ffae 100644
--- a/std/variant.d
+++ b/std/variant.d
@@ -71,7 +71,7 @@ import core.stdc.string, std.conv, std.exception, std.traits, std.typecons,
 @trusted:
 
 /++
-    Gives the $(D sizeof) the largest type given.
+    Gives the `sizeof` the largest type given.
   +/
 template maxSize(T...)
 {
@@ -1194,7 +1194,7 @@ public:
     }
 
     /**
-       If the $(D VariantN) contains an array, applies $(D dg) to each
+       If the `VariantN` contains an array, applies `dg` to each
        element of the array in turn. Otherwise, throws an exception.
      */
     int opApply(Delegate)(scope Delegate dg) if (is(Delegate == delegate))
diff --git a/std/windows/registry.d b/std/windows/registry.d
index 4823f3a7561..1800d83a132 100644
--- a/std/windows/registry.d
+++ b/std/windows/registry.d
@@ -890,11 +890,11 @@ public:
         Returns the named sub-key of this key.
 
         Params:
-            name = The name of the subkey to create. May not be $(D null).
+            name = The name of the subkey to create. May not be `null`.
         Returns:
             The created key.
         Throws:
-            $(D RegistryException) is thrown if the key cannot be created.
+            `RegistryException` is thrown if the key cannot be created.
      */
     Key createKey(string name, REGSAM access = REGSAM.KEY_ALL_ACCESS)
     {
@@ -930,12 +930,12 @@ public:
         Params:
             name = The name of the subkey to aquire. If name is the empty
                    string, then the called key is duplicated.
-            access = The desired access; one of the $(D REGSAM) enumeration.
+            access = The desired access; one of the `REGSAM` enumeration.
         Returns:
             The aquired key.
         Throws:
-            This function never returns $(D null). If a key corresponding to
-            the requested name is not found, $(D RegistryException) is thrown.
+            This function never returns `null`. If a key corresponding to
+            the requested name is not found, `RegistryException` is thrown.
      */
     Key getKey(string name, REGSAM access = REGSAM.KEY_READ)
     {
@@ -969,7 +969,7 @@ public:
         Deletes the named key.
 
         Params:
-            name = The name of the key to delete. May not be $(D null).
+            name = The name of the key to delete. May not be `null`.
      */
     void deleteKey(string name, REGSAM access = cast(REGSAM)0)
     {
@@ -980,11 +980,11 @@ public:
 
     /**
         Returns the named value.
-        If $(D name) is the empty string, then the default value is returned.
+        If `name` is the empty string, then the default value is returned.
 
         Returns:
-            This function never returns $(D null). If a value corresponding
-            to the requested name is not found, $(D RegistryException) is thrown.
+            This function never returns `null`. If a value corresponding
+            to the requested name is not found, `RegistryException` is thrown.
      */
     Value getValue(string name)
     {
@@ -1000,7 +1000,7 @@ public:
             value = The 32-bit unsigned value to set.
         Throws:
             If a value corresponding to the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void setValue(string name, uint value)
     {
@@ -1015,10 +1015,10 @@ public:
             name = The name of the value to set. If it is the empty string,
                    sets the default value.
             value = The 32-bit unsigned value to set.
-            endian = Can be $(D Endian.BigEndian) or $(D Endian.LittleEndian).
+            endian = Can be `Endian.BigEndian` or `Endian.LittleEndian`.
         Throws:
             If a value corresponding to the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void setValue(string name, uint value, Endian endian)
     {
@@ -1039,7 +1039,7 @@ public:
             value = The 64-bit unsigned value to set.
         Throws:
             If a value corresponding to the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void setValue(string name, ulong value)
     {
@@ -1055,7 +1055,7 @@ public:
             value = The string value to set.
         Throws:
             If a value corresponding to the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void setValue(string name, string value)
     {
@@ -1069,11 +1069,11 @@ public:
             name = The name of the value to set. If it is the empty string,
                    sets the default value.
             value = The string value to set.
-            asEXPAND_SZ = If $(D true), the value will be stored as an
+            asEXPAND_SZ = If `true`, the value will be stored as an
                           expandable environment string, otherwise as a normal string.
         Throws:
             If a value corresponding to the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void setValue(string name, string value, bool asEXPAND_SZ)
     {
@@ -1096,7 +1096,7 @@ public:
             value = The multiple-strings value to set.
         Throws:
             If a value corresponding to the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void setValue(string name, string[] value)
     {
@@ -1120,7 +1120,7 @@ public:
             value = The binary value to set.
         Throws:
             If a value corresponding to the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void setValue(string name, byte[] value)
     {
@@ -1131,10 +1131,10 @@ public:
         Deletes the named value.
 
         Params:
-            name = The name of the value to delete. May not be $(D null).
+            name = The name of the value to delete. May not be `null`.
         Throws:
             If a value of the requested name is not found,
-            $(D RegistryException) is thrown.
+            `RegistryException` is thrown.
      */
     void deleteValue(string name)
     {
@@ -1206,7 +1206,7 @@ public:
         Returns:
             The contents of the value.
         Throws:
-            $(D RegistryException) if the type of the value is not REG_SZ,
+            `RegistryException` if the type of the value is not REG_SZ,
             REG_EXPAND_SZ, REG_DWORD, or REG_QWORD.
      */
     @property string value_SZ() const
@@ -1249,7 +1249,7 @@ public:
         Returns:
             The contents of the value.
         Throws:
-            $(D RegistryException) if the type of the value is not REG_MULTI_SZ.
+            `RegistryException` if the type of the value is not REG_MULTI_SZ.
      */
     @property string[] value_MULTI_SZ() const
     {
@@ -1267,7 +1267,7 @@ public:
         Returns:
             The contents of the value.
         Throws:
-            $(D RegistryException) is thrown for all types other than
+            `RegistryException` is thrown for all types other than
             REG_DWORD, REG_DWORD_LITTLE_ENDIAN and REG_DWORD_BIG_ENDIAN.
      */
     @property uint value_DWORD() const
@@ -1286,7 +1286,7 @@ public:
         Returns:
             The contents of the value.
         Throws:
-            $(D RegistryException) if the type of the value is not REG_QWORD.
+            `RegistryException` if the type of the value is not REG_QWORD.
      */
     @property ulong value_QWORD() const
     {
@@ -1309,7 +1309,7 @@ public:
         Returns:
             The contents of the value.
         Throws:
-            $(D RegistryException) if the type of the value is not REG_BINARY.
+            `RegistryException` if the type of the value is not REG_BINARY.
      */
     @property byte[] value_BINARY() const
     {
@@ -1415,7 +1415,7 @@ public:
         Returns:
             The name of the key corresponding to the given index.
         Throws:
-            $(D RegistryException) if no corresponding key is retrieved.
+            `RegistryException` if no corresponding key is retrieved.
      */
     string opIndex(size_t index)
     {
@@ -1492,7 +1492,7 @@ public:
         Returns:
             The key corresponding to the given index.
         Throws:
-            $(D RegistryException) if no corresponding key is retrieved.
+            `RegistryException` if no corresponding key is retrieved.
      */
     Key getKey(size_t index)
     {
@@ -1512,7 +1512,7 @@ public:
         Returns:
             The key corresponding to the given index.
         Throws:
-            $(D RegistryException) if no corresponding key is retrieved.
+            `RegistryException` if no corresponding key is retrieved.
      */
     Key opIndex(size_t index)
     {
@@ -1601,7 +1601,7 @@ public:
         Returns:
             The name of the value corresponding to the given index.
         Throws:
-            $(D RegistryException) if no corresponding value is retrieved.
+            `RegistryException` if no corresponding value is retrieved.
      */
     string getValueName(size_t index)
     {
@@ -1621,7 +1621,7 @@ public:
         Returns:
             The name of the value corresponding to the given index.
         Throws:
-            $(D RegistryException) if no corresponding value is retrieved.
+            `RegistryException` if no corresponding value is retrieved.
      */
     string opIndex(size_t index)
     {
@@ -1688,14 +1688,14 @@ public:
     }
 
     /**
-        The value at the given $(D index).
+        The value at the given `index`.
 
         Params:
             index = The 0-based index of the value to retrieve
         Returns:
             The value corresponding to the given index.
         Throws:
-            $(D RegistryException) if no corresponding value is retrieved
+            `RegistryException` if no corresponding value is retrieved
      */
     Value getValue(size_t index)
     {
@@ -1708,14 +1708,14 @@ public:
     }
 
     /**
-        The value at the given $(D index).
+        The value at the given `index`.
 
         Params:
             index = The 0-based index of the value to retrieve.
         Returns:
             The value corresponding to the given index.
         Throws:
-            $(D RegistryException) if no corresponding value is retrieved.
+            `RegistryException` if no corresponding value is retrieved.
      */
     Value opIndex(size_t index)
     {
diff --git a/std/windows/syserror.d b/std/windows/syserror.d
index 57229b45800..84aaf2ce46e 100644
--- a/std/windows/syserror.d
+++ b/std/windows/syserror.d
@@ -26,7 +26,7 @@ version (StdDdoc)
 
     /// Query the text for a Windows error code (as returned by $(LINK2
     /// http://msdn.microsoft.com/en-us/library/windows/desktop/ms679360.aspx,
-    /// $(D GetLastError))) as a D string.
+    /// `GetLastError`)) as a D string.
     string sysErrorString(
         DWORD errCode,
         // MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT) is the user's default language
@@ -36,20 +36,20 @@ version (StdDdoc)
     /*********************
      * Thrown if errors that set $(LINK2
      * http://msdn.microsoft.com/en-us/library/windows/desktop/ms679360.aspx,
-     * $(D GetLastError)) occur.
+     * `GetLastError`) occur.
      */
     class WindowsException : Exception
     {
         private alias DWORD = int;
-        final @property DWORD code(); /// $(D GetLastError)'s return value.
+        final @property DWORD code(); /// `GetLastError`'s return value.
         @disable this(int dummy);
     }
 
     /++
-        If $(D !!value) is true, $(D value) is returned. Otherwise,
+        If `!!value` is true, `value` is returned. Otherwise,
         $(D new WindowsException(GetLastError(), msg)) is thrown.
-        $(D WindowsException) assumes that the last operation set
-        $(D GetLastError()) appropriately.
+        `WindowsException` assumes that the last operation set
+        `GetLastError()` appropriately.
 
         Example:
         --------------------
@@ -118,7 +118,7 @@ class WindowsException : Exception
 {
     import core.sys.windows.windows;
 
-    final @property DWORD code() { return _code; } /// $(D GetLastError)'s return value.
+    final @property DWORD code() { return _code; } /// `GetLastError`'s return value.
     private DWORD _code;
 
     this(DWORD code, string str=null, string file = null, size_t line = 0) @trusted