Boost logo

Boost :

From: Johan Nilsson (johan.nilsson_at_[hidden])
Date: 2002-12-10 10:58:51

"David Abrahams" <dave_at_[hidden]> wrote in message
> "Johan Nilsson" <johan.nilsson_at_[hidden]> writes:
> > "David Abrahams" <dave_at_[hidden]> wrote in message
> >
> >> A rather lengthy example with no comments or explanatory text
> >> describing what it's supposed to be accomplishing is not very easy to
> >> analyze. If you want feedback from the group, it would be polite to
> >> describe what you're trying to do.
> >>
> >
> > I certainly wasn't being intentionally rude; apologies to anyone
> > offended by my posting.
> Your posting wasn't exactly rude; it just asked for a lot more than it
> probably should from your readers.
> > I just wanted to get some feedback on what I tried, and currently
> > the stuff as a hack. But, as the functionality would be extremely
> > for object factories, I thought I might as well post the code and get
> > comments about it. The hack makes no 'fixed' assumptions on binary
> > layout, rather, it relies on the fact that any polymorphic type can be
> > queried for an implemented interface (aka 'base class'). It does,
> > make the assumption that the location of the rtti itself data is fixed
for a
> > specific c++ implementation across different polymorphic types.
> The quibble I have with all this, which you _still_ haven't satisfied,
> is that you never said in simple terms what you're trying to
> accomplish. A sentence as simple as, "I'm trying to dynamic cast from
> an arbitrary void* to and arbitrary polymorphic object type" would
> have sufficed. I came to this explanation after looking at your code
> below again, and I'm still not sure that's what you're trying to do.

It just might be my english ... anyway, what you stated above pretty much
describes what I was trying to say :).

I'd like to be able to store references to objects of arbitrary types in a
homogenous collection, not requiring them to be derived from a common base
class. For COM users, that would be something like an "IUnknown in the
context of standard C++". I suspect that boost::any might be something
similar to what I need, but I just got that idea using void pointers.

> Incidentally, shared_ptr<void> may allow you the kind of type erasure
> you want. Just a thought...

I' afraid I don't really follow you. Wouldn't shared_ptr<void> choke on
trying to delete through a void pointer?

// Johan

Boost list run by bdawes at, gregod at, cpdaniel at, john at