Ho una classe template per la quale ho alcune specializzazioni.
Ma la specializzazione successiva è un modello stesso. Come si specifica:Specializzazione che è a sua volta un modello
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";}
}
Mi sto solo chiedendo che non lo sai! – Nawaz
@Nawaz: anche il mio pensiero, a tarda notte forse? –
Ora che vedo la risposta è ovvio, ma ho continuato ad aggiungere un'altra linea di template nella loro. –