foreach() behavior on ranges

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Wed Aug 25 09:53:28 UTC 2021


On Wednesday, 25 August 2021 at 06:51:36 UTC, bauss wrote:
> Of course it doesn't disallow classes but it's generally 
> advised that you use structs and that's what you want in 99% of 
> the cases. It's usually a red flag when a range starts being a 
> reference type.

Well, sometimes you can't avoid ref types. For example when you 
need to mask the implementation of the range, but yes, in most of 
the cases best is to use simpler methods to represent ranges.


More information about the Digitalmars-d-learn mailing list