A copy of a concurrent bounded queue doesn't preserve the capacity of the original queue object. #1598
Open
Description
Summary
A copy of a concurrent bounded queue doesn't preserve the capacity of the original queue.
Version
2021.10.0
Environment
AlmaLinux 9
gcc 13.1.0
Observed Behavior
If I set the capacity of an instance of concurrent bounded queue to a specific value and then create a copy of this queue, the capacity of the new object is set to the default value (0x3fffffffffffffff)
Expected Behavior
I would expect the copied queue to retain the same capacity as the original.
Steps To Reproduce
The following code can be used to reproduce the issue:
#include <iostream>
#include <tbb/concurrent_queue.h>
int main(int ac, char**av) {
tbb::concurrent_bounded_queue<int> q;
q.set_capacity(100);
std::cout << "q capacity = " << q.capacity() << std::endl;
tbb::concurrent_bounded_queue<int> q2(q);
std::cout << "q capacity = " << q.capacity() << " q2 capasity = " << q2.capacity() << std::endl;
}
It produces the following output:
q capacity = 100
q capacity = 100 q2 capasity = 4611686018427387903