How can I use boost::lockfree:queue
objects?
I'm trying to write an application that constructs an object of this class via default constructor, but it gives me an assertion failure inside the boost sources:
BOOST_ASSERT(has_capacity);
How can I use the default constructor for this class? Do I need to specify the size of the queue via template arguments?
The capacity can be given statically, so it's even before the default constructor.
boost::lockfree::queue<int, boost::lockfree::capacity<50> > my_queue;
The mechanism resembles named parameters for template arguments.
See it Live On Coliru
#include <boost/lockfree/queue.hpp>
#include <iostream>
using namespace boost::lockfree;
struct X { int i; std::string s; };
int main()
{
queue<int, boost::lockfree::capacity<50> > q;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With