On Tue, Apr 09, 2013 at 01:37:19PM -0700, H. S. Teoh wrote: [...] > Some time ago on the main D mailing list, somebody (deadalnix?) > suggested extending the range interface to have a .transient function > that returns a transient version of the range. The idea goes something > like this: [...]
P.S. I left out one important bit: in order for .transient to be workable in generic code, we make use of UFCS to provide a default .transient method that simply returns the original range: auto transient(R)(R range) { return range; } The idea being that if a particular range doesn't declare .transient, it's non-transient, and any generic code that tries to call .transient will simply get the original range back. So a generic algorithm that is written to be transient-aware will work normally with a normal range with no modifications. T -- Freedom of speech: the whole world has no right *not* to hear my spouting off!