|
Boost : |
Subject: Re: [boost] Generic type inferencer function?
From: Bjorn Reese (breese_at_[hidden])
Date: 2015-12-25 12:38:03
On 12/18/2015 05:54 PM, Vicente J. Botet Escriba wrote:
> There is a draft proposal not yet finished at
>
> https://github.com/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.pdf
I realize that you are attempting to generalize pre-existing make
factories, but I still wanted to raise the following problem because
that is the main reason why I often have to avoid using make_shared.
If I have a class T that always must be created as a shared_ptr (e.g.
because it relies on enable_shared_from_this<T>), then I can ensure
that the class can only be constructed via the factory by making the
constructor of T private, and let the factory be a friend of T. This
works fine if my factory is a static T::create(args...) function, but
not when using make_shared<T>(args...) because in practice it uses
internal helper functions that I cannot make friends of my class.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk