June 16, 2018 Storing temp for later use with ranges | ||||
---|---|---|---|---|
| ||||
Does ranges have the ability to store a temp value in a "range like way" that can be used later? The idea is to avoid having to create temp variables. A sort of range with "memory" |
June 16, 2018 Re: Storing temp for later use with ranges | ||||
---|---|---|---|---|
| ||||
Posted in reply to DigitalDesigns | On Saturday, 16 June 2018 at 01:53:15 UTC, DigitalDesigns wrote: > Does ranges have the ability to store a temp value in a "range like way" that can be used later? > > The idea is to avoid having to create temp variables. A sort of range with "memory" I believe that if the range is a forward range you can use the `.save` method to get a copy of the range in its current state. Take a look at https://dlang.org/phobos/std_range_primitives.html#isForwardRange and https://dlang.org/phobos/std_range_interfaces.html#ForwardRange |
Copyright © 1999-2021 by the D Language Foundation