From 373a192b3ac1e9eb29feec43d8076d9d09712fbb Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 22 Oct 2018 08:39:38 +0200 Subject: [PATCH] Make hasLvalueElements work with non-copyable --- source/tanya/range/primitive.d | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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. *