Why does std.range.zip use emplace instead of simple assignments?

David Nadlinger see at klickverbot.at
Thu Sep 1 01:23:44 PDT 2011


It might well be that I'm missing something obvious in the emplace() 
overload jungle, but what is the reason for std.range.zip to use 
std.conv.emplace for assigning the range elements to the »output« 
elements instead of just using the assignment operator?

https://github.com/D-Programming-Language/phobos/blob/master/std/range.d#L3022
https://github.com/D-Programming-Language/phobos/blob/master/std/range.d#L3058
(and a few other instances)

I'm asking because this is breaking zip() for ranges of class instances 
(the »assignment« overload of emplace() is not defined for them), and 
I'm wondering about the best way to fix it.

Thanks,
David


More information about the Digitalmars-d-learn mailing list