Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost.any] Inline allocation of small objects in any.
From: Adarsh Soodan (adarshsoodan_at_[hidden])
Date: 2011-02-09 12:38:26


On Wed, Feb 9, 2011 at 9:44 PM, Dave Abrahams <dave_at_[hidden]> wrote:
>
> Just to be a little less opaque about this, everyone is asking because what you
> did is very similar to what's done in boost::variant, which led to some very
> interesting problems described in
> http://www.boost.org/doc/libs/1_45_0/doc/html/variant/design.html#variant.design.never-empty
> with very non-obvious solutions.
>
> So you might also consider what happens under assignment when the constructor of
> the new object throws.
>

Thank you. I realize now that the code I posted will have to become
comparatively a lot more complicated to replace boost::any in all
situations. I will clean this up when time permits.

I was curious if others have solved similar performance problems. I
couldn't use boost::variant because I needed it for a message passing
library where library user can pass in any message type.
boost::variant would have been restrictive if the user wanted to use
too many top level types of messages.

- Adarsh Soodan


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