Improved PIBlockingDeque constructors
- resolve creation from constant (see test construct_from_constant_is_max_size_eq_capacity) - add tests for constructors
This commit is contained in:
@@ -41,7 +41,8 @@ public:
|
||||
/**
|
||||
* @brief Copy constructor. Initialize queue with copy of other container elements. Not thread-safe for other queue.
|
||||
*/
|
||||
template<typename Iterable>
|
||||
template<typename Iterable,
|
||||
typename std::enable_if<!std::is_arithmetic<Iterable>::value, int>::type = 0>
|
||||
explicit PIBlockingDequeue(const Iterable& other): PIBlockingDequeue() {
|
||||
mutex.lock();
|
||||
for (const T& t : other) data_queue.push_back(t);
|
||||
@@ -51,7 +52,7 @@ public:
|
||||
/**
|
||||
* @brief Thread-safe copy constructor. Initialize queue with copy of other queue elements.
|
||||
*/
|
||||
inline PIBlockingDequeue(PIBlockingDequeue<T>& other): PIBlockingDequeue() {
|
||||
explicit PIBlockingDequeue(PIBlockingDequeue<T>& other): PIBlockingDequeue() {
|
||||
other.mutex.lock();
|
||||
mutex.lock();
|
||||
max_size = other.max_size;
|
||||
|
||||
Reference in New Issue
Block a user