Interest in std.algorithm.joiner?

Rory Mcguire rjmcguire at gm_no_ail.com
Thu Jul 29 03:07:09 PDT 2010


Andrei Alexandrescu wrote:

> Steven Schveighoffer wrote:
>> On Tue, 27 Jul 2010 14:12:34 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>> 
>>> Steven Schveighoffer wrote:
>>>> On Tue, 27 Jul 2010 11:21:08 -0400, Andrei Alexandrescu
>>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>>
>>>>> We have std.algorithm.splitter which splits a range into components
>>>>> without allocating a new array.
>>>>>
>>>>> Is there an interest in joiner(), the corresponding function for
>>>>> join() that joins elements of a range in conjunction with a
>>>>> separator without allocating a new array?
>>>>  How do you do that?
>>>
>>> Well joiner would offer an input or in best case a forward range with
>>> the range primitives.
>> 
>> How do you store all the ranges you joined for future reference without
>> creating an array of those ranges?  With splitter, it's straightforward,
>> there's one range to store.
>> 
>> Or am I missing something?
> 
> It's just one range and one separator.
> 
> auto joined = joiner(["Mary", "has"], "\t");
> assert(joined.front == 'M');
> 
> 
> Andrei

Not sure, but wouldn't it be better to call that unite?



More information about the Digitalmars-d mailing list