@@ -198,11 +198,15 @@ class RingBufferImplementation : public BufferImplementationBase<BufferT>
198198 /* *
199199 * This member function is thread-safe.
200200 * Two versions for the implementation of the function.
201- * One for buffer containing unique_ptr and the other for other typess
201+ * One for buffer containing unique_ptr and the other for other types
202202 *
203203 * \return a vector containing all the elements from the ring buffer
204204 */
205- template <typename T = BufferT, std::enable_if_t <is_std_unique_ptr<T>::value, void > * = nullptr >
205+ template <typename T = BufferT, std::enable_if_t <is_std_unique_ptr<T>::value &&
206+ std::is_copy_constructible<
207+ typename is_std_unique_ptr<T>::Ptr_type
208+ >::value,
209+ void > * = nullptr >
206210 std::vector<BufferT> get_all_data_impl ()
207211 {
208212 std::lock_guard<std::mutex> lock (mutex_);
@@ -216,7 +220,8 @@ class RingBufferImplementation : public BufferImplementationBase<BufferT>
216220 return result_vtr;
217221 }
218222
219- template <typename T = BufferT, std::enable_if_t <!is_std_unique_ptr<T>::value, void > * = nullptr >
223+ template <typename T = BufferT, std::enable_if_t <
224+ std::is_copy_constructible<T>::value, void > * = nullptr >
220225 std::vector<BufferT> get_all_data_impl ()
221226 {
222227 std::lock_guard<std::mutex> lock (mutex_);
@@ -228,6 +233,23 @@ class RingBufferImplementation : public BufferImplementationBase<BufferT>
228233 return result_vtr;
229234 }
230235
236+ template <typename T = BufferT, std::enable_if_t <!is_std_unique_ptr<T>::value &&
237+ !std::is_copy_constructible<T>::value, void > * = nullptr >
238+ std::vector<BufferT> get_all_data_impl ()
239+ {
240+ throw std::logic_error (" Underlined type results in invalid get_all_data_impl()" );
241+ return {};
242+ }
243+
244+ template <typename T = BufferT, std::enable_if_t <is_std_unique_ptr<T>::value &&
245+ !std::is_copy_constructible<typename is_std_unique_ptr<T>::Ptr_type>::value,
246+ void > * = nullptr >
247+ std::vector<BufferT> get_all_data_impl ()
248+ {
249+ throw std::logic_error (" Underlined type in unique_ptr results in invalid get_all_data_impl()" );
250+ return {};
251+ }
252+
231253 size_t capacity_;
232254
233255 std::vector<BufferT> ring_buffer_;
0 commit comments