Consider the following code
struct foo
{
foo()
{
size_t someCalculatedValue = 2;
bar.resize(someCalculatedValue*4);
std::generate(bar.begin(), bar.end(), [&someCalculatedValue]() {return boost::lockfree::queue<int>(0xFFFF * someCalculatedValue); });
}
std::vector<boost::lockfree::queue<int>> bar;
};
which wouldnt compile, complaining about deleted copy constructor. The queue
is non-copyable, which is ok, but looks like it also non movable? Am I missing something? Is there a way to fill stl container with these?
Of course, one can use something like below, if the capacity of 64k is enough.
struct boo
{
using LocklessQueue = boost::lockfree::queue<int, boost::lockfree::capacity<0xFFFF-1>>;
boo()
{
size_t someCalculatedValue = 2;
bar = std::vector<LocklessQueue>(someCalculatedValue*4);
}
std::vector<LocklessQueue> bar;
};