View mode: basic / threaded / horizontal-split · Log in · Help
April 21, 2010
SListRange assignable elements
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
Top | Discussion index | About this forum | D home