summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2018-08-10 15:34:07 +0200
committerEugen Wissner <belka@caraus.de>2018-08-10 15:34:07 +0200
commit918d8f54503fb1035ffb3465770e6a107950fc99 (patch)
tree167707f93f3afcf0b5a3eb5f0e3ed432b3d7f7e4
parent2862cc6f502b98fd445022cb76e196ecb04021b4 (diff)
downloadtanya-918d8f54503fb1035ffb3465770e6a107950fc99.tar.gz
Deprecated putting an input into an output range
Use copy instead.
-rw-r--r--source/tanya/range/primitive.d19
1 files changed, 18 insertions, 1 deletions
diff --git a/source/tanya/range/primitive.d b/source/tanya/range/primitive.d
index c9134de..72824a5 100644
--- a/source/tanya/range/primitive.d
+++ b/source/tanya/range/primitive.d
@@ -851,6 +851,8 @@ void put(R, E)(ref R range, auto ref E e)
}
else static if (isInputRange!E)
{
+ pragma(msg, "Putting an input range into an output range is "
+ ~ "deprecated. Use tanya.algorithm.mutation.copy instead");
for (; !e.empty; e.popFront())
{
put(range, e.front);
@@ -963,7 +965,22 @@ void put(R, E)(ref R range, auto ref E e)
* Returns: $(D_KEYWORD true) if $(D_PARAM R) is an output range for the
* elements of the type $(D_PARAM E), $(D_KEYWORD false) otherwise.
*/
-enum bool isOutputRange(R, E) = is(typeof((ref R r, ref E e) => put(r, e)));
+template isOutputRange(R, E)
+{
+ static if (is(typeof((R r, E e) => put(r, e))))
+ {
+ enum bool isOutputRange = true;
+ }
+ else static if (isInputRange!E)
+ {
+ alias ET = ElementType!E;
+ enum bool isOutputRange = is(typeof((R r, ET e) => put(r, e)));
+ }
+ else
+ {
+ enum bool isOutputRange = false;
+ }
+}
///
@nogc nothrow pure @safe unittest