pitrou commented on a change in pull request #12341:
URL: https://github.com/apache/arrow/pull/12341#discussion_r801605527
##########
File path: cpp/src/arrow/device.h
##########
@@ -119,13 +119,16 @@ class ARROW_EXPORT MemoryManager : public
std::enable_shared_from_this<MemoryMan
/// The buffer will be allocated in the device's memory.
virtual Result<std::unique_ptr<Buffer>> AllocateBuffer(int64_t size) = 0;
- // XXX Should this take a `const Buffer&` instead
/// \brief Copy a Buffer to a destination MemoryManager
///
/// See also the Buffer::Copy shorthand.
static Result<std::shared_ptr<Buffer>> CopyBuffer(
const std::shared_ptr<Buffer>& source, const
std::shared_ptr<MemoryManager>& to);
+ /// \brief Copy a Buffer to a destination MemoryManager
+ static Result<std::unique_ptr<Buffer>> CopyBuffer(
+ const Buffer& source, const std::shared_ptr<MemoryManager>& to);
Review comment:
I would recommend choosing a different signature and perhaps a different
name to avoid programming errors, e.g.:
```c++
// \brief Copy a non-owned memory area to a destination MemoryManager
static Result<std::unique_ptr<Buffer>> CopyMemory(
uintptr_t source_address, int64_t size, const
std::shared_ptr<MemoryManager>& to);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]