|
Boost Users : |
Subject: Re: [Boost-users] [LockFree] a queue of std::shared_ptr?
From: Michael Caisse (mcaisse-lists_at_[hidden])
Date: 2013-02-12 04:26:37
On 02/11/2013 04:04 PM, Scott Smedley wrote:
> Hi all,
>
> Is it possible to store std::shared_ptr objects in a boost::lockfree::queue?
>
> eg. boost::lockfree::queue<std::shared_ptr<Message>> q;
>
> gcc 4.7.2 with Boost 1.53.0 is giving a static assertion failure. It
> wants: boost::has_trivial_destructor<T>::value and
> boost::has_trivial_assign<T>::value
>
> Any help would be muchly appreciated.
>
> Scott.
>
>
Hi Scott -
Lockfree queues require that the queued type (T) meets the following
requirements:
o T must have a copy constructor
o T must have a trivial assignment operator
o T must have a trivial destructor
shared_ptr has neither a trivial assignment operator or destructor and
cannot be used in the lockfree containers.
michael
-- Michael Caisse ciere consulting ciere.com
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