range and algorithm-related stuff

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 26 18:13:31 PST 2009


"Denis Koroskin" wrote
> On Mon, 26 Jan 2009 23:37:25 +0300, Denis Koroskin <2korden at gmail.com> 
> wrote:
>> Checking if a range is empty() prior to accessing its head is useful. If 
>> empty() is const, you can't do that.
>
> Err.. if empty() is not const and you have a const range reference.

empty not being const does not imply that you can't access a const member. 
Empty not being const allows all access.  The question is whether a wrapping 
range (or any range for that matter) should implement empty as const, as an 
empty that IS const cannot call a non-const function of a member.

-Steve 





More information about the Digitalmars-d mailing list