diff options
Diffstat (limited to 'libphobos/src/std/range')
-rw-r--r-- | libphobos/src/std/range/package.d | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/libphobos/src/std/range/package.d b/libphobos/src/std/range/package.d index 9197134..888ac1a 100644 --- a/libphobos/src/std/range/package.d +++ b/libphobos/src/std/range/package.d @@ -3774,10 +3774,17 @@ private: alias fun = Fun[0]; enum returnByRef_ = (functionAttributes!fun & FunctionAttribute.ref_) ? true : false; + + import std.traits : hasIndirections; + static if (!hasIndirections!(ReturnType!fun)) + alias RetType = Unqual!(ReturnType!fun); + else + alias RetType = ReturnType!fun; + static if (returnByRef_) - ReturnType!fun *elem_; + RetType *elem_; else - ReturnType!fun elem_; + RetType elem_; public: /// Range primitives enum empty = false; @@ -3866,6 +3873,13 @@ public: assert(g.front == f + 5); } +// https://issues.dlang.org/show_bug.cgi?id=23319 +@safe pure nothrow unittest +{ + auto b = generate!(() => const(int)(42)); + assert(b.front == 42); +} + /** Repeats the given forward range ad infinitum. If the original range is infinite (fact that would make `Cycle` the identity application), @@ -6856,6 +6870,7 @@ if (!isIntegral!(CommonType!(B, E)) && assert(!empty); ++current; } + @property auto save() { return this; } } return Result(begin, end); } @@ -6890,6 +6905,13 @@ if (!isIntegral!(CommonType!(B, E)) && assert(i2.equal([3, 4, 0, 1 ])); } +// https://issues.dlang.org/show_bug.cgi?id=23453 +@safe unittest +{ + auto r = iota('a', 'z'); + static assert(isForwardRange!(typeof(r))); +} + /** Options for the $(LREF FrontTransversal) and $(LREF Transversal) ranges (below). |