@@ -240,11 +240,15 @@ class RingBufferImplementation : public BufferImplementationBase<BufferT>
240240 /* *
241241 * This member function is thread-safe.
242242 * Two versions for the implementation of the function.
243- * One for buffer containing unique_ptr and the other for other typess
243+ * One for buffer containing unique_ptr and the other for other types
244244 *
245245 * \return a vector containing all the elements from the ring buffer
246246 */
247- template <typename T = BufferT, std::enable_if_t <is_std_unique_ptr<T>::value, void > * = nullptr >
247+ template <typename T = BufferT, std::enable_if_t <is_std_unique_ptr<T>::value &&
248+ std::is_copy_constructible<
249+ typename is_std_unique_ptr<T>::Ptr_type
250+ >::value,
251+ void > * = nullptr >
248252 std::vector<BufferT> get_all_data_impl ()
249253 {
250254 std::lock_guard<std::mutex> lock (mutex_);
@@ -258,7 +262,8 @@ class RingBufferImplementation : public BufferImplementationBase<BufferT>
258262 return result_vtr;
259263 }
260264
261- template <typename T = BufferT, std::enable_if_t <!is_std_unique_ptr<T>::value, void > * = nullptr >
265+ template <typename T = BufferT, std::enable_if_t <
266+ std::is_copy_constructible<T>::value, void > * = nullptr >
262267 std::vector<BufferT> get_all_data_impl ()
263268 {
264269 std::lock_guard<std::mutex> lock (mutex_);
@@ -270,6 +275,23 @@ class RingBufferImplementation : public BufferImplementationBase<BufferT>
270275 return result_vtr;
271276 }
272277
278+ template <typename T = BufferT, std::enable_if_t <!is_std_unique_ptr<T>::value &&
279+ !std::is_copy_constructible<T>::value, void > * = nullptr >
280+ std::vector<BufferT> get_all_data_impl ()
281+ {
282+ throw std::logic_error (" Underlined type results in invalid get_all_data_impl()" );
283+ return {};
284+ }
285+
286+ template <typename T = BufferT, std::enable_if_t <is_std_unique_ptr<T>::value &&
287+ !std::is_copy_constructible<typename is_std_unique_ptr<T>::Ptr_type>::value,
288+ void > * = nullptr >
289+ std::vector<BufferT> get_all_data_impl ()
290+ {
291+ throw std::logic_error (" Underlined type in unique_ptr results in invalid get_all_data_impl()" );
292+ return {};
293+ }
294+
273295 size_t capacity_;
274296
275297 std::vector<BufferT> ring_buffer_;
0 commit comments