私はいくつかの専門化があるテンプレートクラスを持っています。
しかし、次の特殊化はテンプレート自体です。これをどのように指定しますか:それ自体がテンプレートである特殊化
template<typename T>
class Action
{
public: void doStuff() { std::cout << "Generic\n"; }
}
// A specialization for a person
template<>
class Action<Person>
{
public: void doStuff() { std::cout << "A Person\n";}
}
// I can easily specialize for vectors of a particular type.
// But how do I change the following so that it works with all types of vector.
// Not just `int`
template<>
class Action<std::vector<int> >
{
public: void doStuff() { std::cout << "A Generic Vector\n";}
}
私はちょうどあなたがこれを知らないと思っています! – Nawaz
@Nawaz:私の考えだけでなく、おそらく深夜? –
答えが分かり次第、私は自分のテンプレートに別のテンプレート行を追加し続けました。 –