Closed pengweichu closed 1 year ago
You're passing in an iterator to an empty vector. The queue will therefore write past the end of the vector (technically undefined behaviour despite the reserve).
Either resize the vector first, or use a back inserter:
v.resize(16);
v.resize(mQueue.wait_dequeue_bulk(v.begin(), v.size()));
mQueue.wait_dequeue_bulk(std::back_inserter(v), 16);
thanks, that works good.
Hi again, I have the below code that I can get the wait_dequeue_bulk_timed returned correctly size, but the v is empty. Could you please point where is wrong?
It's works good with the array or std::array, can't I use it with vector?