From 1769ae31cea6ffc41c6f29a68ab84ec4dfda91dc Mon Sep 17 00:00:00 2001 From: Yu Kun Date: Mon, 26 Aug 2019 21:23:58 +0800 Subject: [PATCH] fix status constructor bugs Former-commit-id: 6d3921dd4cdbdbe7869425b603122760eb27366d --- cpp/src/sdk/include/Status.h | 5 ++--- cpp/src/sdk/interface/Status.cpp | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cpp/src/sdk/include/Status.h b/cpp/src/sdk/include/Status.h index 0ef994a69e..7804f681f5 100644 --- a/cpp/src/sdk/include/Status.h +++ b/cpp/src/sdk/include/Status.h @@ -86,8 +86,7 @@ public: * @param status, status to be moved. * */ - inline - Status(Status &&s) noexcept : state_(s.state_) {}; + Status(Status &&s) noexcept ; /** * @brief Status @@ -173,7 +172,7 @@ public: static Status OK(Args &&... args) { return Status(StatusCode::OK, MessageBuilder(std::forward(args)...)); -} + } /** * @brief Invalid diff --git a/cpp/src/sdk/interface/Status.cpp b/cpp/src/sdk/interface/Status.cpp index 4ec1482cc3..14c43ce084 100644 --- a/cpp/src/sdk/interface/Status.cpp +++ b/cpp/src/sdk/interface/Status.cpp @@ -28,6 +28,10 @@ void Status::MoveFrom(Status &s) { Status::Status(const Status &s) : state_((s.state_ == nullptr) ? nullptr : new State(*s.state_)) {} +Status::Status(Status &&s) noexcept { + MoveFrom(s); +} + Status &Status::operator=(const Status &s) { if (state_ != s.state_) { CopyFrom(s);