Bidirectional range dilemma

Peter Alexander peter.alexander.au at gmail.com
Sun Jan 13 05:22:25 PST 2013


On Sunday, 13 January 2013 at 12:34:38 UTC, bearophile wrote:
> (By the way, what's the API of your functions? In similar 
> generators I usually add a boolean doCopy template argument, 
> that defaults to true. If it's true, the generator yields 
> different buffers, otherwise it yields always the same modified 
> buffer. This allows to have both convenience & safety on 
> default, and speed on request).

Interesting.

I do empathize with having convenience and safety by default and 
speed on demand, but in this case I worry about the performance 
lost by not having speed as the default, especially since I 
imagine that most of the time the safety is unneeded.

If speed is the default then the template parameter is unneeded 
since you can just do permutations(r).map!array(). This is what I 
currently do.


More information about the Digitalmars-d mailing list