diff options
| author | Eugen Wissner <belka@caraus.de> | 2018-10-22 08:39:38 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2018-10-22 08:39:38 +0200 |
| commit | 373a192b3ac1e9eb29feec43d8076d9d09712fbb (patch) | |
| tree | c20fbc133a0728262239303f1bfb28a62087dd10 /source | |
| parent | 4e8c9bd28fe6c6569814ffa3854544e11b1d346b (diff) | |
| download | tanya-373a192b3ac1e9eb29feec43d8076d9d09712fbb.tar.gz | |
Make hasLvalueElements work with non-copyable
Diffstat (limited to 'source')
| -rw-r--r-- | source/tanya/range/primitive.d | 12 |
1 files changed, 11 insertions, 1 deletions
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. * |
