Boost logo

Boost Users :

Subject: [Boost-users] [lockfree] Queue with shared_ptr as elements
From: sguazt (marco.guazzone_at_[hidden])
Date: 2013-03-30 09:57:21


Hello,

Is it possible to use lockfree::queue with shared_ptr as element types?

For instance,

---[code]---
#include <boost/lockfree/queue.hpp>
#include <boost/smart_ptr.hpp>

class foobar
{
};

int main()
{
    typedef boost::shared_ptr<foobar> element_type;
    typedef boost::lockfree::queue<element_type> queue_type;

    queue_type queue;
}
---[/code]---

If I compile the above code I get the following error:

---[error]---
boost_lockfree_mwmr_queue.cpp:13:13: required from here
~/projects/svn/boost-trunk/boost/lockfree/queue.hpp:81:5: error: invalid
application of ‘sizeof’ to incomplete type
‘boost::STATIC_ASSERTION_FAILURE<false>’
~/projects/svn/boost-trunk/boost/lockfree/queue.hpp:85:5: error: invalid
application of ‘sizeof’ to incomplete type
‘boost::STATIC_ASSERTION_FAILURE<false>’
---[/error]---

If I use "foobar" or "foobar*" as element_type, it works.

I'm using
- GCC 4.7.2 with the following options enabled: -Wextra -Wall -ansi
-pedantic
- boost SVN trunk version

Thank you very much for helping.

Best,

-- Marco



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