Why in Phobos is empty() sometimes const and sometimes not

Matt gamblemj at gmail.com
Mon Jul 29 17:32:58 UTC 2019


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.


More information about the Digitalmars-d-learn mailing list