Make hasLvalueElements work with non-copyable
This commit is contained in:
parent
4e8c9bd28f
commit
373a192b3a
@ -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.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user