std.v2020.algorithm etc[ WAS: Is run.d going to be expand for runtime and the phobos library?]
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Wed Jun 24 16:08:05 UTC 2020
On 6/24/20 10:17 AM, Joseph Rushton Wakeling wrote:
>
> I'm struck that no one AFAICS has suggested the following alternative:
> instead of `tail`, to allow popFront() (and if implemented, popBack())
> to return an `Option!(ElementType, None)`.
>
> What is returned would be either the popped element, or None if no more
> elements remain (with the nice by-product of no longer getting assert
> failures if pop{Front,Back} are called when the range is empty).
I think the discussion about tail() had to do with immutable ranges.
Having popXxx() return something would still have it mutate the range.
More information about the Digitalmars-d
mailing list