After seeing that a template can be partially specialized for reference or pointer types, I was wondering whether I can write a template that accepts only a pointer type to start with. This is my attempt:
template <typename T*>
struct MyTemplate{};
int main() {
MyTemplate<int *> c;
(void)c;
return 0;
}
This does not compile. How should it be modified? (i.e. if what I am trying to accomplish is at all possible)
Aucun commentaire:
Enregistrer un commentaire