On Wednesday, 29 April 2015 at 23:22:43 UTC, Ali Çehreli wrote:
On 04/29/2015 04:16 PM, Ali Çehreli wrote:
ref CustomInteger opOpAssign(string op, T2)(T2 rhs)
{
static if (is (T2 == CustomInteger)) {
mixin("value_ " ~ op ~ "= rhs.value_;");
return this;
} else {
return this.opOpAssign!(op,
CustomInteger)(CustomInteger(rhs));
Playing a little more, the following shorter equivalent of the
last line works as well:
return opOpAssign!op(CustomInteger(rhs));
Ali
How do I disable it?
I need to prohibit all operations to the type int.
-----
auto b = Balance(42);
int t = 4;
t += b; // error in compile time