Adapting foreign iterators to D ranges
Alexandru Ermicioi
alexandru.ermicioi at gmail.com
Mon Apr 22 17:16:30 UTC 2024
On Monday, 22 April 2024 at 11:36:43 UTC, Chloé wrote:
> The first implementation has the advantage is being simpler and
> empty being const, but has the downside that next is called
> even if the range ends up not being used. Is either approach
> used consistently across the D ecosystem?
You can also place initialization logic inside front, then empty
could become const.
I don't think there is a preffered way of initializing such
ranges, so imho consider what's best for your use case.
More information about the Digitalmars-d-learn
mailing list