
21 Oct
2009
21 Oct
'09
1:09 p.m.
Stewart, Robert wrote:
Ireneusz Szpilewski wrote:
[...] I don't care what you call it. There is no good reason to do this in C++.
[snipped examples of using containers of heterogeneous types.]
I'm well aware of uses of this approach and they are usually misguided. A common base class is not terribly helpful. One specific to a particular use case is far more useful. Using your approach encourages programming with dynamic_cast. There are times when it is needed, but its use should be limited and not encouraged generally.
I think of rtti_base as of yet another screwdriver in our toolbox. The more tools we have, the more various things we can do. As you wrote:
"There are times when it is needed" ;-) so, why not to have it?
Ireneusz Szpilewski