disable all member function calls for rvalues?
dsimcha
dsimcha at yahoo.com
Thu Dec 17 21:38:36 PST 2009
== Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
> There is a wart in D I'd like to eliminate. Unfortunately, that would
> also eliminate some valid uses.
I'll say. One more example that I forgot to include, but I think is pretty important:
struct CheckedInt {
int num;
/// Rest of implementation.
bool opEquals(CheckedInt rhs) const {
return num == rhs.num;
}
}
CheckedInt fun() {
return CheckedInt(5);
}
assert(fun() == CheckedInt(5)); // Wouldn't compile.
Requiring an explicit temp variable here is so utterly ridiculous that, if D
required one, it would rightfully be made the laughing stock among programming
languages.
More information about the Digitalmars-d
mailing list