Use case: eliminate hidden allocations in buildPath

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Dec 5 07:00:07 PST 2013


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


More information about the Digitalmars-d mailing list