void Foo2(vector<gsl_vector*>& v){
....
A.process(v[i]);
....
}
How can I integrate Foo1 and Foo2 into a template function? Thanks.
zl2k
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Assuming (living dangerously) that I'm not missing a subtlety, what's
wrong with the obvious? :)
template <typename T>
void Foo(vector<T>& v)
{
....
A.process(v[i]);
....
}
Cheers,
Stu
Why is
template<class T>
void foo_template(vector<T>& v) {
....
A.process(v[i]);
....
}
insufficient?
[Your question was ambiguous. Please specify your problem
the next time a bit clearer. It also reduces unnecessary
noise in this group]
HTH & Greetings from Bremen,
Daniel Krügler
Is something like this...
template<typename T> get_t(T& t)
{
return t;
}
template<typename T> get_t(T*& t)
{
return *t;
}
template<typename T>
void foo_template(vector<T>& v)
{
T& get_t(v[i]);
A.process(t);
}
....what you're after (it needs some more work/thought).
Louis.