Transience of .front in input vs. forward ranges
Mehrdad
wfunction at hotmail.com
Mon Nov 5 22:46:34 PST 2012
On Tuesday, 6 November 2012 at 04:49:45 UTC, Tommi wrote:
> On Tuesday, 6 November 2012 at 04:31:56 UTC, H. S. Teoh wrote:
>> The problem is that you can't do this in generic code, because
>> generic code by definition doesn't know how to copy an
>> arbitrary type.
>
> I'm not familiar with that definition of generic code. But I do
> feel that there's a pretty big problem with a language design
> if the language doesn't provide a generic way to make a copy of
> a variable. To be fair, e.g. C++ doesn't provide that either.
C++ as a language doesn't, but if you follow the convention that
C++ establishes in its libraries (where copy assignment & copy
construction == deep copy), it always works out correctly.
D doesn't have that convention so that's why we're running into
trouble.
More information about the Digitalmars-d
mailing list