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 06:27:28 PDT 2016


On Wednesday, 25 May 2016 at 12:08:20 UTC, Steven Schveighoffer 
wrote:
> On 5/25/16 6:24 AM, pineapple wrote:
>> On Tuesday, 24 May 2016 at 20:18:34 UTC, Steven Schveighoffer 
>> wrote:
>>> Slice assignment from range to array is not supported.
>>>
>>> In your example, I'm curious why the efforts to specify the 
>>> type? I
>>> think it would work with just saying auto itemstrings = ...
>>>
>>
>> I still get an error if I use auto instead.
>
> OK, I see the other issue now. map takes a range, whereas you 
> are giving it a tuple.
>
> -Steve

Why can the tuple be iterated with foreach, as in my quick fix, 
and indexed with tuple[0..], but is not accepted as a range? What 
are the differences? Is there a way to rangify a tuple?


More information about the Digitalmars-d-learn mailing list