From 3085c2eb333ada32c851a816ae7ecef5867a7eff Mon Sep 17 00:00:00 2001
From: ketmar <ketmar@ketmar.no-ip.org>
Date: Tue, 31 Mar 2015 08:26:49 +0300
Subject: [PATCH 5/5] std.variant opover fix

---
 std/variant.d | 50 ++++++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/std/variant.d b/std/variant.d
index 20b6dc6..7143a4d 100644
--- a/std/variant.d
+++ b/std/variant.d
@@ -1010,11 +1010,13 @@ public:
      * arithmetic conversions.
      */
 
+    alias opBinaryRight = opBinary;
+
     // Adapted from http://www.prowiki.org/wiki4d/wiki.cgi?DanielKeep/Variant
     // arithmetic
-    VariantN opAdd(T)(T rhs) { return opArithmetic!(T, "+")(rhs); }
+    VariantN opBinary(string op : "+", T)(T rhs) { return opArithmetic!(T, "+")(rhs); }
     ///ditto
-    VariantN opSub(T)(T rhs) { return opArithmetic!(T, "-")(rhs); }
+    VariantN opBinary(string op : "-", T)(T rhs) { return opArithmetic!(T, "-")(rhs); }
 
     // Commenteed all _r versions for now because of ambiguities
     // arising when two Variants are used
@@ -1025,50 +1027,50 @@ public:
     //     return VariantN(lhs).opArithmetic!(VariantN, "-")(this);
     // }
     ///ditto
-    VariantN opMul(T)(T rhs) { return opArithmetic!(T, "*")(rhs); }
+    VariantN opBinary(string op : "*", T)(T rhs) { return opArithmetic!(T, "*")(rhs); }
     ///ditto
-    VariantN opDiv(T)(T rhs) { return opArithmetic!(T, "/")(rhs); }
+    VariantN opBinary(string op : "/", T)(T rhs) { return opArithmetic!(T, "/")(rhs); }
     // ///ditto
     // VariantN opDiv_r(T)(T lhs)
     // {
     //     return VariantN(lhs).opArithmetic!(VariantN, "/")(this);
     // }
     ///ditto
-    VariantN opMod(T)(T rhs) { return opArithmetic!(T, "%")(rhs); }
+    VariantN opBinary(string op : "%", T)(T rhs) { return opArithmetic!(T, "%")(rhs); }
     // ///ditto
     // VariantN opMod_r(T)(T lhs)
     // {
     //     return VariantN(lhs).opArithmetic!(VariantN, "%")(this);
     // }
     ///ditto
-    VariantN opAnd(T)(T rhs) { return opLogic!(T, "&")(rhs); }
+    VariantN opBinary(string op : "&", T)(T rhs) { return opLogic!(T, "&")(rhs); }
     ///ditto
-    VariantN opOr(T)(T rhs) { return opLogic!(T, "|")(rhs); }
+    VariantN opBinary(string op : "|", T)(T rhs) { return opLogic!(T, "|")(rhs); }
     ///ditto
-    VariantN opXor(T)(T rhs) { return opLogic!(T, "^")(rhs); }
+    VariantN opBinary(string op : "^", T)(T rhs) { return opLogic!(T, "^")(rhs); }
     ///ditto
-    VariantN opShl(T)(T rhs) { return opLogic!(T, "<<")(rhs); }
+    VariantN opBinary(string op : "<<", T)(T rhs) { return opLogic!(T, "<<")(rhs); }
     // ///ditto
     // VariantN opShl_r(T)(T lhs)
     // {
     //     return VariantN(lhs).opLogic!(VariantN, "<<")(this);
     // }
     ///ditto
-    VariantN opShr(T)(T rhs) { return opLogic!(T, ">>")(rhs); }
+    VariantN opBinary(string op : ">>", T)(T rhs) { return opLogic!(T, ">>")(rhs); }
     // ///ditto
     // VariantN opShr_r(T)(T lhs)
     // {
     //     return VariantN(lhs).opLogic!(VariantN, ">>")(this);
     // }
     ///ditto
-    VariantN opUShr(T)(T rhs) { return opLogic!(T, ">>>")(rhs); }
+    VariantN opBinary(string op : ">>>", T)(T rhs) { return opLogic!(T, ">>>")(rhs); }
     // ///ditto
     // VariantN opUShr_r(T)(T lhs)
     // {
     //     return VariantN(lhs).opLogic!(VariantN, ">>>")(this);
     // }
     ///ditto
-    VariantN opCat(T)(T rhs)
+    VariantN opBinary(string op : "~", T)(T rhs)
     {
         auto temp = this;
         temp ~= rhs;
@@ -1083,29 +1085,29 @@ public:
     // }
 
     ///ditto
-    VariantN opAddAssign(T)(T rhs)  { return this = this + rhs; }
+    VariantN opOpAssign(string op : "+", T)(T rhs)  { return this = this + rhs; }
     ///ditto
-    VariantN opSubAssign(T)(T rhs)  { return this = this - rhs; }
+    VariantN opOpAssign(string op : "-", T)(T rhs)  { return this = this - rhs; }
     ///ditto
-    VariantN opMulAssign(T)(T rhs)  { return this = this * rhs; }
+    VariantN opOpAssign(string op : "*", T)(T rhs)  { return this = this * rhs; }
     ///ditto
-    VariantN opDivAssign(T)(T rhs)  { return this = this / rhs; }
+    VariantN opOpAssign(string op : "/", T)(T rhs)  { return this = this / rhs; }
     ///ditto
-    VariantN opModAssign(T)(T rhs)  { return this = this % rhs; }
+    VariantN opOpAssign(string op : "%", T)(T rhs)  { return this = this % rhs; }
     ///ditto
-    VariantN opAndAssign(T)(T rhs)  { return this = this & rhs; }
+    VariantN opOpAssign(string op : "&", T)(T rhs)  { return this = this & rhs; }
     ///ditto
-    VariantN opOrAssign(T)(T rhs)   { return this = this | rhs; }
+    VariantN opOpAssign(string op : "|", T)(T rhs)   { return this = this | rhs; }
     ///ditto
-    VariantN opXorAssign(T)(T rhs)  { return this = this ^ rhs; }
+    VariantN opOpAssign(string op : "^", T)(T rhs)  { return this = this ^ rhs; }
     ///ditto
-    VariantN opShlAssign(T)(T rhs)  { return this = this << rhs; }
+    VariantN opOpAssign(string op : "<<", T)(T rhs)  { return this = this << rhs; }
     ///ditto
-    VariantN opShrAssign(T)(T rhs)  { return this = this >> rhs; }
+    VariantN opOpAssign(string op : ">>", T)(T rhs)  { return this = this >> rhs; }
     ///ditto
-    VariantN opUShrAssign(T)(T rhs) { return this = this >>> rhs; }
+    VariantN opOpAssign(string op : ">>>", T)(T rhs) { return this = this >>> rhs; }
     ///ditto
-    VariantN opCatAssign(T)(T rhs)
+    VariantN opOpAssign(string op : "~", T)(T rhs)
     {
         auto toAppend = Variant(rhs);
         fptr(OpID.catAssign, &store, &toAppend) == 0 || assert(false);
-- 
1.8.4

