Comment #0 by john.michael.hall — 2021-05-15T02:34:22Z
DDOC doesn't handle the case where you have multiple functions within a single template. It will do a better job when some of the functions are also templates. You get similar behavior with multiple outer templates.
The examples below are compiled with dmd -main -D filename.
1) Contrast the documentation of this one
```d
/++
Foo
+/
template foo(T, U)
if (is(T : int) && !is(U : int))
{
///
void foo(V)(T x, U y, V z) {}
///
void foo(U x, T y) {}
}
```
with this one. The one above looks fine, exactly as you would expect. The one below merges the first one with the outer level and then doesn't show the inner level at all.
```d
/++
Foo
+/
template foo(T, U)
if (is(T : int) && !is(U : int))
{
///
void foo(T x, U y) {}
///
void foo(U x, T y) {}
}
```
2) This example looks at the case of multiple outer templates. Contrast this with the one below
```d
/++
Foo
+/
template foo(T, U)
if (is(T : int) && !is(U : int))
{
///
void foo(V)(T x, U y, V z) {}
///
void foo(U x, T y) {}
}
/// ditto
template foo(T)
if (is(T : int))
{
///
void foo(T x, T y) {}
///
void foo(T x) {}
}
```
The one above shows the same information as what is in 1) above but also adds the merged second definition of foo. The one below only shows the top level merged ones.
```d
/++
Foo
+/
template foo(T, U)
if (is(T : int) && !is(U : int))
{
///
void foo(T x, U y) {}
///
void foo(U x, T y) {}
}
/// ditto
template foo(T)
if (is(T : int))
{
///
void foo(T x, T y) {}
///
void foo(T x) {}
}
```
Here is a practical example:
https://github.com/libmir/mir-algorithm/blob/0965ada3d13b4be831875b0b754be9e7ae81999b/source/mir/math/stat.d#L339
Here are the associated docs:
http://mir-algorithm.libmir.org/mir_math_stat.html#.mean
Comment #1 by john.michael.hall — 2021-05-15T11:58:04Z