|
Boost : |
From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-01-30 22:57:11
"Larry Evans" <jcampbell3_at_[hidden]> wrote in message
news:3E39B452.3060605_at_prodigy.net...
[...]
> Only if you want to collect cycles or provide some other means for
> accessing the arcs in the pointer graph. As a matter of fact, it may
> be better to do somewhat like shared_ptr does, i.e. instead of storing
> a ip_descriptor*, just store something like counted_base, where the
> actual instance is a derived class, counted_impl<T>, which knows the
> "real" type, T, of the object pointed to.
What about typeid(* m_ptr).name() which is also virtual and returns a real
compile-time id?
template <typename T>
struct identifier
{
static type_info const value = typeid(T);
};
template <typename T>
type_info const identifier<T>::value;
...
template <typename T, typename U>
bool compare()
{
return (& identifier<T>::value == & identifier<U>::value)
}
...
compare<A, B>();
Philippe A. Bouchard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk