On Monday, 29 July 2019 at 19:38:34 UTC, Jonathan M Davis wrote:
On Monday, July 29, 2019 11:32:58 AM MDT Matt via Digitalmars-d-learn wrote:



Because const ranges are basically useless, there really isn't much point in putting const on any range functions even if it would work for that particular range, and if a range is a wrapper range, the only way that it could do it would be if it used static if to make the code differ depending on whether the range it's wrapping will work if that function is const, which essentially means duplicating a bunch of code for little to no benefit.

- Jonathan M Davis

This was super helpful, thanks so much. I thought it was good practice to label member functions const if they didn't/couldn't modify any data. Now I see the reality is different for ranges. Not worrying about const for these seems simpler than code repetition.

Thanks again.

Reply via email to