From fa21b9527423d043241ef1e9da6bfa142f998860 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 6 Mar 2015 23:55:52 +0900 Subject: [PATCH] asio: Provide move constructor and move assignment operator to server::http2 --- src/asio_server_http2.cc | 12 ++++++++++++ src/includes/nghttp2/asio_http2_server.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/asio_server_http2.cc b/src/asio_server_http2.cc index f00d77cd..e33b38ef 100644 --- a/src/asio_server_http2.cc +++ b/src/asio_server_http2.cc @@ -40,6 +40,18 @@ http2::http2() : impl_(make_unique()) {} http2::~http2() {} +http2::http2(http2 &&other) : impl_(std::move(other.impl_)) {} + +http2 &http2::operator=(http2 &&other) { + if (this == &other) { + return *this; + } + + impl_ = std::move(other.impl_); + + return *this; +} + boost::system::error_code http2::listen_and_serve(boost::system::error_code &ec, const std::string &address, const std::string &port) { diff --git a/src/includes/nghttp2/asio_http2_server.h b/src/includes/nghttp2/asio_http2_server.h index 21c662c5..c43408cc 100644 --- a/src/includes/nghttp2/asio_http2_server.h +++ b/src/includes/nghttp2/asio_http2_server.h @@ -126,6 +126,9 @@ public: http2(); ~http2(); + http2(http2 &&other); + http2 &operator=(http2 &&other); + // Starts listening connection on given address and port and serves // incoming requests in cleartext TCP connection. boost::system::error_code listen_and_serve(boost::system::error_code &ec,