上面是我讀一本書測試過的例子,書中曾說:This is only one example of code that might behave differently than expected as a result of detailed overload resolution rules. For example, the fact that not all overloaded functions are visible when a corresponding function call is made may or may not matter. In fact, defining a three-argument version of max() without having seen the declaration of a special two-argument version of max() for ints causes the two-argument template to be used by the three-argument version:,這里的意思比較適合第二種情況,即”一個是:inline int const& max申明在template <typename T>
inline T const& max之后。”,我沒有能在其他C++編譯器上測試過,不知道C++標準中是否規(guī)定FunctionTemplate Resolution Rules,如果沒有,依據(jù)上面的英文描述,不同編譯器有不同的FunctionTemplate Resolution Rule,有可能template <typename T>
inline T const& max (T const& a, T const& b, T const& c) 不可見到申明在后的inline int const& max。
大家的意見呢?