Why is std.algorithm so complicated to use?
Christophe Travert
travert at phare.normalesup.org
Tue Jul 10 09:47:38 PDT 2012
Andrei Alexandrescu , dans le message (digitalmars.D:171723), a écrit :
>> auto emptyRange(E)(E value)
>> {
>> return repeat(value).takeNone;
>> }
> That also seems to answer Jonathan's quest about defining emptyRange.
> Just use takeNone(R.init).
err, that should be more like:
auto singletonRange(E)() // with no parameters
{
return takeNone!type_of(repeat(E.init))();
}
An emptyRange compatible with singletonRange should be called
singletonRange and take no parameter, so that emptyRange name could be
reserved to a real statically empty range (which is pretty easy to
implement).
--
Christophe
More information about the Digitalmars-d
mailing list