Primary Ranges of Containers

Christophe Travert travert at phare.normalesup.org
Tue Jun 19 05:54:47 PDT 2012


Jonathan M Davis , dans le message (digitalmars.D:170054), a écrit :
>> I'd propose to always add a bool template parameter (maybe isConst?) to
>> the range since most of the write-functionality can be "removed" by a
>> static if statement in order to make the range read-only.
>> 
>> Any suggestions?

Boolean parameters are very obscure.
How do you guess what is the meaning of false in:
Range!false;

Range!IsConst.no would be better.

> struct ArrayRange(bool isConst) {...}
> alias ArrayRange!false Range;
> alias ArrayRange!true ConstRange;

Range and ConstRange seems a good thing to have, just like c++ 
containers have iterator and const_iterator.



More information about the Digitalmars-d mailing list