Which set is "Mark's set"? The last one I posted ~100 minutes ago using
the signatures mentioned by Mark and
including an implementation?
It's still slower depending on the cost of the move, only for some classes
Yeah, when I did the tests your post wasn't up yet, but we have essentially the exact same implementation of Mark's idea. the compiler can optimize that
cost away.
I take it you're comparing the return rvalue vs. return rvalue ref? If so, quite possibly yes. I'll see if I can't identify under what practical situations this solution performs worse compared to returning r-value refs.
Anyways, let's explore the best "return rvalues" version. I think the last version I posted should be really close, except if someone can come up with a pass-by-value version and expressions where it works better in practice.
I think that for now we might start with the code I posted and if future compilers are able to support and optimize pass-by-value to allow even better code, we might detect these compilers and use a different implementation.
Sounds good to me. FWIW, I extended this solution to the other cases. All other cases have 4 overloads except for commutative T + U which has 8. It should be a copy/paste replacement that should work with the operators2.hpp test-bed. Link: http://codepad.org/HdII3G0b