digitalmars.D - SListRange assignable elements
- bearophile (21/21) Apr 20 2010 If you add this method (a little tested):
If you add this method (a little tested):
/// ditto
void front(T newvalue)
{
enforce(_root);
_root._value = newvalue;
}
to std.range.SListRange, then std.range.hasAssignableElements on it is true.
Is this a meaningful/useful change?
And isn't an assert enough and faster inside those SListRange methods? Linked
list sometimes have to be fast, while adding execptions to all their methods
might be less efficient.
So I think something like this can be enough (untested):
/// ditto
void front(T newvalue)
in {
assert(_root);
body {
_root._value = newvalue;
}
Bye,
bearophile
Apr 20 2010








bearophile <bearophileHUGS lycos.com>