Rewriting a c++ template to D (replacing iterator with ranges "properly")

aliak something at something.com
Fri Jan 26 15:33:03 UTC 2018


On Friday, 26 January 2018 at 14:35:25 UTC, Meta wrote:
> On Friday, 26 January 2018 at 14:16:04 UTC, aliak wrote:
>> 1) I've seen some phobos code checking for assignability like 
>> this:
>>
>>   is(typeof(range.front = false))
>>
>> ... is that an advantage of that over hasAssignableElements? 
>> Or is that just basically combining constraints 3 and 4 which 
>> I have above?
>
> Where did you see this? That's got to be some very old code; I 
> can't think of any instance where you would not want to use 
> `hasAssignableElements` instead.

Seems to occur in 
https://github.com/dlang/phobos/blob/v2.078.1/std/algorithm/mutation.d

eg: 
https://github.com/dlang/phobos/blob/v2.078.1/std/algorithm/mutation.d#L555




More information about the Digitalmars-d-learn mailing list