cpu.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
9 
10 #include <memory>
11 #include <type_traits>
12 
13 namespace raft_proto {
14 namespace detail {
15 template <typename T>
17  // TODO(wphicks): Assess need for buffers of const T
18  using value_type = std::remove_const_t<T>;
19 
20  owning_buffer() : data_{std::unique_ptr<T[]>{nullptr}} {}
21 
22  owning_buffer(std::size_t size) : data_{std::make_unique<T[]>(size)} {}
23 
24  auto* get() const { return data_.get(); }
25 
26  private:
27  // TODO(wphicks): Back this with RMM-allocated host memory
28  std::unique_ptr<T[]> data_;
29 };
30 } // namespace detail
31 } // namespace raft_proto
Definition: buffer.hpp:24
device_type
Definition: device_type.hpp:7
std::remove_const_t< T > value_type
Definition: cpu.hpp:18
owning_buffer(std::size_t size)
Definition: cpu.hpp:22
Definition: base.hpp:16