diff --git a/source/tanya/range/primitive.d b/source/tanya/range/primitive.d index 7495d65..5dc9efc 100644 --- a/source/tanya/range/primitive.d +++ b/source/tanya/range/primitive.d @@ -1828,7 +1828,7 @@ template hasMobileElements(R) */ template hasLvalueElements(R) { - private alias refDg = (ref ElementType!R e) => e; + private alias refDg = (ref ElementType!R e) => &e; static if (isRandomAccessRange!R) { @@ -1886,6 +1886,16 @@ template hasLvalueElements(R) 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. *