Make hasLvalueElements work with non-copyable

This commit is contained in:
Eugen Wissner 2018-10-22 08:39:38 +02:00
parent 4e8c9bd28f
commit 373a192b3a
1 changed files with 11 additions and 1 deletions

View File

@ -1828,7 +1828,7 @@ template hasMobileElements(R)
*/ */
template hasLvalueElements(R) template hasLvalueElements(R)
{ {
private alias refDg = (ref ElementType!R e) => e; private alias refDg = (ref ElementType!R e) => &e;
static if (isRandomAccessRange!R) static if (isRandomAccessRange!R)
{ {
@ -1886,6 +1886,16 @@ template hasLvalueElements(R)
static assert(hasLvalueElements!R2); static assert(hasLvalueElements!R2);
} }
// Works with non-copyable elements
@nogc nothrow pure @safe unittest
{
static struct NonCopyable
{
@disable this(this);
}
static assert(hasLvalueElements!(NonCopyable[]));
}
/** /**
* Determines whether the elements of $(D_PARAM R) are assignable. * Determines whether the elements of $(D_PARAM R) are assignable.
* *