From 05e4330ecb671709472b7cdc013e433f7ad1449e Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 24 Jan 2024 11:39:21 +0200 Subject: [PATCH] circular_buffer_fixed_capacity: use std::uninitialized_move() instead of open-coding The code even contains a comment about it, so standardize the code. Closes scylladb/seastar#2054 --- include/seastar/core/circular_buffer_fixed_capacity.hh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/seastar/core/circular_buffer_fixed_capacity.hh b/include/seastar/core/circular_buffer_fixed_capacity.hh index 8ae8cf22de0..c29d609ec3d 100644 --- a/include/seastar/core/circular_buffer_fixed_capacity.hh +++ b/include/seastar/core/circular_buffer_fixed_capacity.hh @@ -33,6 +33,7 @@ #include #include #include +#include #include #endif @@ -224,11 +225,7 @@ template inline circular_buffer_fixed_capacity::circular_buffer_fixed_capacity(circular_buffer_fixed_capacity&& x) noexcept : _begin(x._begin), _end(x._end) { - // This is std::uninitialized_move, but that is c++17 only - auto dest = begin(); - for (auto& obj : x) { - new (&*dest++) T(std::move(obj)); - } + std::uninitialized_move(x.begin(), x.end(), begin()); } template