InputRange help: (1) repeated dtor calls and (2) managing resources needing free()

James Blachly james.blachly at gmail.com
Mon Aug 20 02:29:23 UTC 2018


On Monday, 13 August 2018 at 13:20:25 UTC, Seb wrote:

> BTW it's very uncommon for empty to do work, it's much more 
> common to do such lazy initialization in `.front`.
>

Thanks Seb, that entire reply is a huge help.

By lazy initialization in `.front`, do you mean that I should 
find a way for `front` to preload the first record?

If so, could you help me understand what you mean by lazy init 
with `front`? `empty` is called before `front` upon first 
iteration through the Range, so really the init has to be done in 
the constructor, yes?




More information about the Digitalmars-d-learn mailing list