Thread overview
[Issue 13654] @nogc std.algorithm.enumerate
[Issue 13654] @nogc std.range.enumerate
Nov 21, 2015
bb.temp@gmx.com
Mar 21, 2020
Basile-z
January 10, 2015
https://issues.dlang.org/show_bug.cgi?id=13654

--- Comment #1 from bearophile_hugs@eml.cc ---
A possible solution is to replace this:


auto enumerate(Enumerator = size_t, Range)(Range range, Enumerator start = 0)
    if (isIntegral!Enumerator && isInputRange!Range)
...
        if (overflow || result > Enumerator.max)
            throw new RangeError("overflow in `start + range.length`");
    }
}
...



With this:


auto enumerate(Enumerator = size_t, Range)(Range range, Enumerator start = 0)
@nogc
    if (isIntegral!Enumerator && isInputRange!Range)
...
        if (overflow || result > Enumerator.max) {
            static immutable err = new RangeError("overflow in `start +
range.length`");
            throw err;
        }
    }
}
...


But I don't know if immutable errors are really correct.

--
January 10, 2015
https://issues.dlang.org/show_bug.cgi?id=13654

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|@nogc                       |@nogc std.range.enumerate
                   |std.algorithm.enumerate     |

--
November 21, 2015
https://issues.dlang.org/show_bug.cgi?id=13654

bb.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bb.temp@gmx.com
         Resolution|---                         |FIXED

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=13654

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--