On Monday, 29 July 2019 at 17:32:58 UTC, Matt wrote:
I've noticed that for some ranges in Phobos empty is marked const (e.g. iota) but for other ranges (e.g. multiwayMerge) it is not const. Is there a reason why? Isn't empty guaranteed not to alter the data of the range and so should be const?

This is causing me considerable headaches as I try to write my own ranges that accept other ranges and have it all work for the general case. Any advice would be welcome.

You could use introspection (a static i) to check if the type defines a const/non-const version and write the appropriate empty declaration.

As for why it’s like this I’ll have to look at the code in Phobos, but I’m currently away from my pc (on the phone).

Cheers,
Edi

Reply via email to