|
Boost Users : |
Subject: Re: [Boost-users] Boost.Signals2 - tracking an object managed with tr1::shared_ptr
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-09-11 12:31:35
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 10 September 2009, Monteleone, Nathan wrote:
> Is it possible to use slot::track with a tr1::shared_ptr instead of a
> boost::shared_ptr?
Sorry, not at present. I've thought about it a bit, especially with respect
to std::shared_ptr, but haven't gotten around to doing anything about it. It
wouldn't be too hard to support some fixed set of shared_ptr types using
boost::variant. Maybe an additional slow path that uses heap allocation and
some type traits could support unforeseen shared_ptr types.
> For example:
>
> std::tr1::shared_ptr<MyObject> o;
> typedef boost::signals2::signal<void(void)> SigType;
> SigType s;
>
> // Error: canât convert std::tr1::shared_ptr<MyObject> to boost::weak_ptrâ¦
> s.connect(SigType::slot_type(&MyObject::function, o.get()).track(o));
>
>
> According to the docs you HAVE to use boost::shared_ptr. Iâm just hoping
> thereâs some traits specialization or something I can provide so that I can
> get away with using the tr1 version instead (all our code is already
> written with tr1).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqqe2cACgkQ5vihyNWuA4Ux8QCgkBLWJPceO9MhKWqHMlp3GeWA
MusAoOChRRFcOaIz/WuJY6mN644bVB5p
=uH2d
-----END PGP SIGNATURE-----
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