it fixes the issue You can declare the operator as a friend of the class. Edit: I seem to have tomatoes on my eyes, your operator is class member and already has private access. You could friend it however it was defined outside of class scope.
Check presence of custom overload of function when template overload is available
seems to work fine I am designing an utility header that pumps binary data off an sf::InputStream. For ease of use, is comprises a single function name, readFromStream, that has a lot of (templated and non-templated) overloads for automatically deserializing standard-layout types and type compounds like vectors, tuples and my custom-designed grid class. The complete implementation can be found here: https://github.com/JoaoBaptMG/ReboundTheGame/blob/master/MainGame/utility/streamCommons.hpp , As I understand it your problem is:
using is_optimization_viable<T> = std::is_standard_layout<T>;
To fix this issue @titian-cernicova-dragomir answered my actual answer in the comments of his answer. Here I've written down what I concluded from his answer and my own testing. Typescript doesnt allow for the name-choosing of given parameters based on their type (without explicitly writing the type check yourself). The only logic overloads implement in Typescript (at least as of now) is a check whether the overloads fit with the implementation in input and return types, and the choice of the fitting override to determine the return type.
Why isn't overload resolution picking the std::vector overload of my template function?
wish of those help The type deduced by the forwarding reference is std::vector&, as opposed to the const std::vector& of the other overload. So when comparing the overloads, your non-const argument is a better match for the non-const qualified reference parameter, and so that one is chosen. One way to address it is to account for both const qualifications with the help of another overload.
around this issue One big difference between template specializafions and overloads is that overloads allow implicit conversions of arguments, while template specializations do not. Continuing your example, how will float argument be handled? func(double param) will be chosen, but the generic template will be instantiated. Often the former is correct. More generally, there are reasons to prefer non-template code. Templates must usually reside in a header, which slows down compilation and exposes implementation to everybody. Templates cause more cryptic compilation error messages and are not supported by tools very well. E.g. Visual studio 2015 does not give intellisense info for templates.