fix status constructor bugs

Former-commit-id: 6d3921dd4cdbdbe7869425b603122760eb27366d
pull/191/head
Yu Kun 2019-08-26 21:23:58 +08:00
parent 39fc00f943
commit 1769ae31ce
2 changed files with 6 additions and 3 deletions

View File

@ -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>(args)...));
}
}
/**
* @brief Invalid

View File

@ -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);