Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-12-10 11:28:48


"Johan Nilsson" <johan.nilsson_at_[hidden]> writes:

> 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?

No it won't; it's perfectly suited to the application you cite.
Check out the documentation.

HTH,

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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