Suppose I have something like:
template <class T>
void do_something(T t){
pass_it_somewhere(t);
t->do_something();
}
Now it would be useful that T is allowed to be a pointer or a value. Function do_something(...) can basically handle pointers and values, except for the t->do_something(). For pointers, I would need a -> and for values, I would need a . to access members.
Is there a way to make T accept pointers and values?
Aucun commentaire:
Enregistrer un commentaire