Re: Auto-documentation, Streamers, and virtual functions

From: George Heintzelman (gah@bnl.gov)
Date: Wed Feb 16 2000 - 21:48:16 MET


> Your macro is OK. However, your point 2 is not correct.
> Adding functions to a class cannot double the size of an instance,
> unless you have only one instance of these classes.

Not so. If you add virtual functions when there are none before, you 
add the pointer to the vtbl to the object structure. If you have only 
one (say, pointer) data member, this doubles the size of each object. 
This is why I specified small classes 'which do not have their own 
virtual functions' for that group of uses.

This is one reason why most of the STL classes do not use virtual 
functions. (Note: IMHO, in many cases it wouldn't make a difference, 
but in the case of iterators or smart pointers in particular it most 
assuredly would.)

George



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET