AMDG Peng Yu wrote:
This is a reasonable solution. But no matter which namespace multiply_traits puts, it pollutes that namespace. Since namespace is a way to better organized the code, I'd rather multiply_traits be in the same namespace as that of its associated types.
A generic multiply_traits is not tied to any specific type. You can always put it in a detail namespace.
Since Koenig lookup can be used to deduce the namespace of a function based on whether its arugments are from, I'm wondering why C++ does not allow such look up for templates? If Koenig lookup can be used for template, then the problem is solved.
That would cause worse problems. Koenig lookup can cause obscure, hard to find bugs in generic code, when the wrong function is called. In Christ, Steven Watanabe