|
Boost : |
Subject: Re: [boost] Formal Review Request: TypeErasure
From: Nevin Liber (nevin_at_[hidden])
Date: 2012-06-22 14:23:32
On 22 June 2012 11:03, Hite, Christopher <
Christopher.Hite_at_[hidden]> wrote:
>
> > Why not give him one he can move, so e.g. he can put it in a vector
> without getting into dynamic allocation?
> Why not give him a unmovable object and let him put it in a smart pointer,
> deciding if he wants a singlton, single owner or shared instance?
>
It adds noise and makes it harder to reason about. You've
Here is one example: When you see a vector<shared_ptr<Foo>>, is the
author's intentions:
a) Make Foo storable in a vector
b) Foo is polymorphic
c) Really meant to have shared ownership for these Foo objects
Now, if the author made Foo copyable and type erasure took care of
polymorphism, vector<shared_ptr<Foo>> is really about having shared
ownership.
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk