What's wrong with my usage of std.algorithm.map in this code example?
Chris via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed May 25 08:00:58 PDT 2016
On Wednesday, 25 May 2016 at 14:48:14 UTC, ag0aep6g wrote:
> On 05/25/2016 04:39 PM, Chris wrote:
>> I see. Maybe it would be worth adding a wrapper to
>> typecons.Tuple or
>> std.range that helps to rangify tuples.
>
> std.range.only is that wrapper.
Duh! Of course! :-)
>> I cannot think of any use case
>> right now. I never needed this and in the example that started
>> this
>> thread, it would keep the function from converting mixed
>> tuples (cf. my
>> example above).
>
> I'm not sure what you're saying here. Should the wrapper
> support tuples with different element types? Can't be a range
> then as a range has just one element type.
I'm saying that for the above example something like
std.range.only doesn't make sense, because the user might want to
turn anything into string as in
test(1, 2, "v", 4, 'c');
Mixed type tuples cannot be rangified, of course (and
std.range.only takes care of that).
More information about the Digitalmars-d-learn
mailing list