Boost logo

Boost :

Subject: [boost] [intrusive] rtti_base class proposition
From: Ireneusz Szpilewski (irek_at_[hidden])
Date: 2009-10-20 07:43:46


Hi,

Here is my idea for this little class:

class rtti_base
{
     virtual void _dummy() {}
};

Every class deriving from rtti_base can be queried
by means of RTTI, in particular rtti_base class
and dynamic_cast can be used in similar way
as IUnknown and QueryInterface() in
COM Object Model

rtti_base* could be used as a "smart" void*
pointer - we can get type information,
and use it in heterogenic containers
as in:

 std::list<rtti_base*> beings;

we can iterate through beings and
call Cat::GiveMilk() for cats
but Girl::Kiss() for girls. :-)

The main purpose of this class is
to set some standard name for that
pointer type.

Ireneusz Szpilewski


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