Boost logo

Boost :

Subject: Re: [boost] [intrusive] rtti_base class proposition
From: Matus Chochlik (chochlik_at_[hidden])
Date: 2009-10-21 12:54:53


On Wed, Oct 21, 2009 at 3:09 PM, Ireneusz Szpilewski
<irek_at_[hidden]> wrote:
> 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 agree that defining and using a common base class for all other classes
in a project is in 99% of cases a very bad idea. There is a book called
"C++ Gotchas: Avoiding Common Problems in Coding and Design"
and the use of such "cosmic hierarchies" is a gotcha #97 ;-)

>>>
>>>
>>>>
>>>> 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
>>>>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
________________
::matus_chochlik

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk