Главная страница | назад





Article #16817: Sizeof template parameter

 Question and Answer Database
FAQ1817C.txt Sizeof template parameter
Category :C/C++ Language Issues
Platform :All
Product :C++Builder 1.x
Question:
BC++ 5.02 and C++Builder do not allow sizeof() to take
a template parameter. How do I get around this?
Answer:
The behavior is a result of a bug in BC++ 5.02 and C++Builder.
Borland is aware of the bug. In the interim, the following hack
will get around the problem:
template  class foo {
struct hack {T t; };
enum _sz {SIZE = sizeof(t) };
}
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99