From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-07-28 14:41:17
-----BEGIN PGP SIGNED MESSAGE-----
On Monday 28 July 2008 10:29 am, Daniel Frey wrote:
> On Mon, 2008-07-28 at 08:52 -0400, Frank Mori Hess wrote:
> > I don't think the zero-argument call to make_shared resolves to the
> > variadic template, see the make_shared.hpp file.
> I've seen that, but:
> a) I don't understand what the "new T()" vs. "new T" issue is - and
> there seems to be nothing in the code which explains that. It does use
> new T(), which should also work for new T( Args... ) if Args is a
> zero-sized parameter pack, shouldn't it?
> b) Looking at N2352 and N2691, there should be only one make_shared.
> Boost vs. GCC already shows that looking at a concrete implementation is
> not enough. Question is, what is/should be guaranteed by the standard.
> If nothing like this is guaranteed (probably because it's simply too
> late?), I would end up with non-portable code. Even then I would be
> interested in whether or not you, Peter, etc. think if something like
> that should be at least targeted for TR2...
I'm just saying the friend declaration might need to be simply
template< typename A >
friend std::shared_ptr< A > std::make_shared();
due to the overload for zero arguments in make_shared.hpp. I should mention I
didn't notice before that you were actually using std:: instead of boost::
and I'm not actually familiar with the gcc 4.3 implementations.
> d) Besides the use case above, what do you think about using this
> pattern to allow shared_from_this to be called in the ctor? Is this
> possible? Would it be useful?
Do you mean something like a more generic version of deconstruct_ptr:
except it would have the benefits provided by make_shared, and allow a class
to force its use via private constructor/friendship? It seems like it could
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk