From 00558b38db535b6ee99185caa97efd50d0aa9d29 Mon Sep 17 00:00:00 2001 From: Billy Donahue Date: Mon, 21 Jan 2019 16:42:25 -0500 Subject: [PATCH] VS2013 doesn't allow move ops to be =default --- include/json/value.h | 4 ++-- src/lib_json/json_value.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/json/value.h b/include/json/value.h index 9a2d10ddc..a62f4828b 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -659,9 +659,9 @@ Json::Value obj_value(Json::objectValue); // {} public: Comments() = default; Comments(const Comments& that); - Comments(Comments&&) = default; + Comments(Comments&& that); Comments& operator=(const Comments& that); - Comments& operator=(Comments&&) = default; + Comments& operator=(Comments&& that); bool has(CommentPlacement slot) const; String get(CommentPlacement slot) const; void set(CommentPlacement slot, String s); diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 7102f8857..5ce007998 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -1440,11 +1440,19 @@ bool Value::isObject() const { return type() == objectValue; } Value::Comments::Comments(const Comments& that) : ptr_{cloneUnique(that.ptr_)} {} +Value::Comments::Comments(Comments&& that) + : ptr_{std::move(that.ptr_)} {} + Value::Comments& Value::Comments::operator=(const Comments& that) { ptr_ = cloneUnique(that.ptr_); return *this; } +Value::Comments& Value::Comments::operator=(Comments&& that) { + ptr_ = std::move(that.ptr_); + return *this; +} + bool Value::Comments::has(CommentPlacement slot) const { return ptr_ && !(*ptr_)[slot].empty(); }