From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2008-01-10 09:35:22
> The final (best?) solution I came with now is using RTTI. RTTI's typeid() is
> by design non-intrusive (actually the way it is implemented by the compiler
> is intrusive but it happens anyway for any polymorphic type so why not use
> it) and it does not have any of the problems listed above, the implementation
> is "small enough" that I can include it here:
If I understand correctly, your implementation is O(n) with n =
size(typelist), right? The advantage of virtual calls is that they're
O(1), no matter how big the hierarchy.
Though if that is a problem in the real world is a different question.
How big are visited class hierarchies usually?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk