mirror of
https://github.com/boostorg/process.git
synced 2026-01-19 04:22:15 +00:00
implement move operations for process_io_binding and delete copy operations
This makes the test added in the previous commit pass.
This commit is contained in:
committed by
Klemens Morgenstern
parent
4bb842564f
commit
e842a060f1
@@ -166,6 +166,31 @@ struct process_io_binding
|
||||
}
|
||||
|
||||
process_io_binding() = default;
|
||||
process_io_binding(const process_io_binding &) = delete;
|
||||
process_io_binding & operator=(const process_io_binding &) = delete;
|
||||
|
||||
process_io_binding(process_io_binding && other) noexcept
|
||||
: fd(other.fd), fd_needs_closing(other.fd), ec(other.ec)
|
||||
{
|
||||
other.fd = target;
|
||||
other.fd_needs_closing = false;
|
||||
other.ec = {};
|
||||
}
|
||||
|
||||
process_io_binding & operator=(process_io_binding && other) noexcept
|
||||
{
|
||||
if (fd_needs_closing)
|
||||
::close(fd);
|
||||
|
||||
fd = other.fd;
|
||||
fd_needs_closing = other.fd_needs_closing;
|
||||
ec = other.ec;
|
||||
|
||||
other.fd = target;
|
||||
other.fd_needs_closing = false;
|
||||
other.ec = {};
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Stream>
|
||||
process_io_binding(Stream && str, decltype(std::declval<Stream>().native_handle()) * = nullptr)
|
||||
|
||||
Reference in New Issue
Block a user