digitalmars.D.learn - Storing temp for later use with ranges
- DigitalDesigns (4/4) Jun 15 2018 Does ranges have the ability to store a temp value in a "range
- Timoses (7/11) Jun 15 2018 I believe that if the range is a forward range you can use the
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"
Jun 15 2018
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
Jun 15 2018