Is it legal to use variadic templates in operator overloading?
问题 I would like to be able to write something along these lines: struct bar {}; template <typename ... Args> bar operator+(bar, Args ...) {} I just checked with clang/gcc and the overloaded operator is picked up both by binary expressions ( a+b ) and unary expressions ( +a ), as I would expect. However operators are more restricted than normal functions, in the sense that - for instance - you cannot overload operator+() with three arguments. Is the usage above legal and portable? EDIT To give a