mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
allow n=0 for std.meta.Repeat
This commit is contained in:
parent
ca4677117f
commit
2eb41fd1bc
1 changed files with 8 additions and 2 deletions
10
std/meta.d
10
std/meta.d
|
@ -1317,9 +1317,12 @@ private template SmartAlias(T...)
|
|||
* Creates an `AliasSeq` which repeats a type or an `AliasSeq` exactly `n` times.
|
||||
*/
|
||||
template Repeat(size_t n, TList...)
|
||||
if (n > 0)
|
||||
{
|
||||
static if (n == 1)
|
||||
static if (n == 0)
|
||||
{
|
||||
alias Repeat = AliasSeq!();
|
||||
}
|
||||
else static if (n == 1)
|
||||
{
|
||||
alias Repeat = AliasSeq!TList;
|
||||
}
|
||||
|
@ -1344,6 +1347,9 @@ if (n > 0)
|
|||
///
|
||||
@safe unittest
|
||||
{
|
||||
alias ImInt0 = Repeat!(0, int);
|
||||
static assert(is(ImInt0 == AliasSeq!()));
|
||||
|
||||
alias ImInt1 = Repeat!(1, immutable(int));
|
||||
static assert(is(ImInt1 == AliasSeq!(immutable(int))));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue