Boost logo

Boost Users :

Subject: Re: [Boost-users] [Interprocess] Collection of base shared_ptr
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2012-04-03 17:28:06


El 03/04/2012 21:18, Aaron_Wright_at_[hidden] escribió:
> I'm using Boost 1.49, and Visual Studio 10.
>
> I'm having a hard time figuring out how to store a shared_ptr to a
> derived class in a collection of shared_ptr to the base class. This
> is something I do all the time with normal shared pointers. This is
> my code:

You can't do that. In shared memory there is no place for virtuality (so
no room for virtual destructors essential to be able to use derived
classes). boost::interproces::shared_ptr is only for reference counted
semantics.

Best,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net