Skip to content

Commit

Permalink
Fix: dataset_t move-constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Jan 19, 2025
1 parent e70d6a8 commit 434cad7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions reduce_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,20 @@ struct dataset_t {
std::size_t numa_nodes = 1;

dataset_t() noexcept = default;
dataset_t(dataset_t &&) = default;
dataset_t(dataset_t const &) = delete;

std::size_t size() const noexcept { return length; }
dataset_t(dataset_t &&other) noexcept
: begin(other.begin), length(other.length), allocator(other.allocator), huge_pages(other.huge_pages),
numa_nodes(other.numa_nodes) {
other.begin = nullptr;
other.length = 0;
other.allocator = allocator_t::unknown;
other.huge_pages = huge_pages_t::unknown;
other.numa_nodes = 1;
}

float *data() const noexcept { return begin; }
std::size_t size() const noexcept { return length; }

~dataset_t() noexcept {
switch (allocator) {
Expand Down

0 comments on commit 434cad7

Please sign in to comment.