On Thursday, 5 December 2013 at 15:00:07 UTC, Andrei Alexandrescu wrote:
On 12/5/13 12:52 AM, monarch_dodra wrote:
On Thursday, 5 December 2013 at 08:45:08 UTC, Jacob Carlborg wrote:
On 2013-12-05 09:09, monarch_dodra wrote:

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.

In general case, what would you suggest for functions not operating on
ranges?

How do you mean? As in functions that only output a "single item"?

Returns a non-linear data structure such as a hash table.

Andrei

Output range! :)

Output range interface makes no linearity requirements. Just that: "out.put(this)" compiles.

Reply via email to