mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
support for empty static arrays in ElementEncodingType
This commit is contained in:
parent
a4b9321901
commit
43a77fa50c
1 changed files with 17 additions and 1 deletions
18
std/range.d
18
std/range.d
|
@ -1044,6 +1044,14 @@ unittest
|
|||
static assert(is(ElementType!(inout(int)[]) : inout(int)));
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
static assert(is(ElementType!(int[5]) == int));
|
||||
static assert(is(ElementType!(int[0]) == int));
|
||||
static assert(is(ElementType!(char[5]) == dchar));
|
||||
static assert(is(ElementType!(char[0]) == dchar));
|
||||
}
|
||||
|
||||
unittest //11336
|
||||
{
|
||||
static struct S
|
||||
|
@ -1063,7 +1071,7 @@ $(D ElementType).
|
|||
template ElementEncodingType(R)
|
||||
{
|
||||
static if (isNarrowString!R)
|
||||
alias typeof(lvalueOf!R[0]) ElementEncodingType;
|
||||
alias typeof(*lvalueOf!R.ptr) ElementEncodingType;
|
||||
else
|
||||
alias ElementType!R ElementEncodingType;
|
||||
}
|
||||
|
@ -1086,6 +1094,14 @@ unittest
|
|||
static assert(is(ElementEncodingType!(inout char[]) : inout(char)));
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
static assert(is(ElementEncodingType!(int[5]) == int));
|
||||
static assert(is(ElementEncodingType!(int[0]) == int));
|
||||
static assert(is(ElementEncodingType!(char[5]) == char));
|
||||
static assert(is(ElementEncodingType!(char[0]) == char));
|
||||
}
|
||||
|
||||
/**
|
||||
Returns $(D true) if $(D R) is a forward range and has swappable
|
||||
elements. The following code should compile for any range
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue