3 ms·
Super cool hack for adding infix operators in C++
- JoeAltmaier 12y agoCool, kinda. A variant is more generally useful. To call a template function who's return type depends on the LHS, return an intermediate object instance that encapsulates the fn arguments, and has a template conversion overload that makes the real underlying call, and dynamic_cast<>s the return type to the conversion type as its value.