template func in class question
From: Active8 (reply2group_at_ndbbm.net)
Date: 02/27/05
- Previous message: Ivan Vecerina: "Re: How to get file descriptor permissions?"
- Next in thread: Jonathan Turkanis: "Re: template func in class question"
- Reply: Jonathan Turkanis: "Re: template func in class question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 27 Feb 2005 02:34:36 -0500
I have an STL vector I pass to a function and I need to know what
type data is in the vector when I'm in the fuction.
class MyClass
{
template class<T>
int Myfunc(T&){int i = sizeof(T);// oops - I want sizeof(float) }
};
vector<float> vec;
MyClass mc;
mc.Myfunc(vec)
Is there any way to do this without writing separate functions for
each type of data the vector might contain? And without a 2
parameter template *class* like "template class<V, T>" ?
Thanks in advance.
-- Best Regards, Mike
- Previous message: Ivan Vecerina: "Re: How to get file descriptor permissions?"
- Next in thread: Jonathan Turkanis: "Re: template func in class question"
- Reply: Jonathan Turkanis: "Re: template func in class question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|