チュートリアルに基づいて、</p>
// Example 2: Explicit specialization
//
template<class T> // (a) a base template
void f( T ){;}
template<class T> // (b) a second base template, overloads (a)
void f( T* ){;} // (function templates can't be partially
// specialized; they overload instead)
template<> // (c) explicit specialization of (b)
void f<>(int*){;} // ===> Method one
また、警告なしで VS2010 SP1 で以下をテストします。
template<> // (c) alternative
void f<int>(int*){;} // ==> Method two
質問> C++ 標準に基づく推奨される方法はどれですか? 方法1または方法2?
ご覧のとおり、方法 1 と方法 2 の主な違いは次のとおりです。
template<>
void f<>(int*){;} // ===> Method one
template<>
void f<int>(int*){;} // ===> Method two
^^^
チュートリアルに基づいて、代わりに次の単純な古い関数を作成する必要があります。
void f(int*){;}
しかし、それは私が尋ねている質問ではありません:)
ありがとうございました