Reputation: 31
Design problem- one function calls all three
I continuation from another question after that thread, here is what I try:
template<class T>
void func(T* p)
{
p->
}
I am stuck after that arrow as I don't know how to access each element of the which vector I passed in? The func
receives argument as a switch case, I have solved it but the code inside all repeated except the vector. :-(
I am new about template, please help me.
Thank you.
Upvotes: 0
Views: 73
Reputation: 249303
template<class T>
void func(T*p)
{
(*p)[0]; // the first element of the passed-in vector (or array)
}
Upvotes: 2