Skip to content

Commit

Permalink
circular_buffer_fixed_capacity: use std::uninitialized_move() instead…
Browse files Browse the repository at this point in the history
… of open-coding

The code even contains a comment about it, so standardize the code.

Closes scylladb#2054
  • Loading branch information
avikivity authored and xemul committed Jan 25, 2024
1 parent b73f5ff commit 05e4330
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions include/seastar/core/circular_buffer_fixed_capacity.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <cstddef>
#include <iterator>
#include <utility>
#include <memory>
#include <seastar/util/modules.hh>
#endif

Expand Down Expand Up @@ -224,11 +225,7 @@ template <typename T, size_t Capacity>
inline
circular_buffer_fixed_capacity<T, 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 <typename T, size_t Capacity>
Expand Down

0 comments on commit 05e4330

Please sign in to comment.