Hi Jacek,
> None of them has the "value_type" implemented, though ...
You should not need it for those ... I must be confused on what you are trying to do.
Anyway if you really need to you can specialize you template:
template <class T> class MyTemplate {
// generic version with assume that T is also a template
typedef T value_type;
... Use sizeof(value_type) and sizeof(value_type::value_type);
}
// specialization
Template <class T> class MyTemplate <complex<T> > {
// semi-generic version for complex
typedef complex<T> value_type;
... Use sizeof(value_type) and sizeof(T) ...
}
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch]
On Behalf Of Jacek M. Holeczek
Sent: Friday, January 21, 2005 2:32 AM
To: RootTalk
Subject: RE: [ROOT] the sizeof "internal class" ... a question to C++ gurus
Hi,
> template <class T> MyTemplate {
> public:
> typedef T value_type;
> };
>
> Then you can do
> sizeof(MyTemplate<MyClass>::value_type)
Nice trick, indeed.
Any other ideas?
Thanks in advance,
Best regards,
Jacek.
Received on Fri Jan 21 2005 - 16:18:50 MET
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET