Created
January 26, 2014 21:57
Revisions
-
kmichel created this gist
Jan 26, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #include <iostream> class DotOp { }; class LhsDotOp { public: int value; explicit LhsDotOp(int value) : value(value) {} }; // Of course you should have vector instead of int and the real operation instead of + ;) LhsDotOp operator*(int value, DotOp) { return LhsDotOp(value); } int operator*(LhsDotOp lhs_dot_op, int value) { return lhs_dot_op.value + value; } #define DOT * DotOp() * int main(int, char**) { std::cout << 42 DOT 34; return 0; }