From 49540acf70c99e4755151234134c1766de6968af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tall=C3=B3di=20Mih=C3=A1ly?= Date: Mon, 19 Sep 2016 18:14:34 +0200 Subject: [PATCH] Move constructor support for Writer --- include/rapidjson/writer.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h index c5a3b98a92..f8e7d2e32f 100644 --- a/include/rapidjson/writer.h +++ b/include/rapidjson/writer.h @@ -103,6 +103,14 @@ class Writer { Writer(StackAllocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) : os_(0), level_stack_(allocator, levelDepth * sizeof(Level)), maxDecimalPlaces_(kDefaultMaxDecimalPlaces), hasRoot_(false) {} +#ifdef RAPIDJSON_HAS_CXX11_RVALUE_REFS + Writer(Writer &&other) : + os_(other.os_), level_stack_(std::move(other.level_stack_)), maxDecimalPlaces_(other.maxDecimalPlaces_), hasRoot_(other.hasRoot_) + { + other.os_=nullptr; + } +#endif + //! Reset the writer with a new stream. /*! This function reset the writer with a new stream and default settings,