On Wednesday, 4 December 2013 at 23:14:48 UTC, Andrei Alexandrescu wrote:
Hello,

Walter and I were talking about eliminating the surreptitious allocations in buildPath:

http://dlang.org/phobos/std_path.html#.buildPath

We'd need to keep the existing version working, so we're looking at adding one or more new overloads. We're looking at giving the user the option to control any needed memory allocation (or even arrange things such that there's no memory allocated at all).

It's a generous design space, so although we have a couple of ideas let's hear others first.


Thanks,

Andrei

Use an output range. It's the generic D approach, and what we already do for the string functions such as std.string.translate:
http://dlang.org/phobos/std_string.html#.translate
(look down for the output range overloads).

Anything "allocator" related should be carried by the output range itself. The function itself should not care nor know about any of that.

Reply via email to