PhobosWatch: manifest => enum
Janice Caron
caron800 at googlemail.com
Sat Dec 29 19:31:14 PST 2007
On 12/30/07, Janice Caron <caron800 at googlemail.com> wrote:
> In full agreement with you, Walter, having understood all your points
> (at last), but what if we allowed:
>
> const MyInt m = 3;
> auto n = m.dup;
>
> It would be no trouble at all for MyInt to supply a dup() function
> whose return value had type MyInt.
>
> The only question is, will it work for plain ints?
>
> const int m = 3;
> auto n = m.dup;
>
> And if not, can it be made to work? (That is, can we implement dup for
> all primitive types?)
Actually, come to think of it, the implementation of MyInt.dup would have to be
struct MyInt
{
int x;
MyInt dup() const { return x.dup; }
}
so it actually wouldn't work /unless/ dup worked for primitive types.
More information about the Digitalmars-d
mailing list