From 568107e178c700fecc7eb3c0da483b1a95a01ece Mon Sep 17 00:00:00 2001 From: Hartwig Date: Wed, 10 May 2017 22:56:01 +0200 Subject: [PATCH] Add convenience method Key(std::basic_string const&) to Writer --- include/rapidjson/writer.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h index 61cd070..e610ebb 100644 --- a/include/rapidjson/writer.h +++ b/include/rapidjson/writer.h @@ -222,6 +222,13 @@ public: bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); } +#if RAPIDJSON_HAS_STDSTRING + bool Key(const std::basic_string& str) + { + return Key(str.data(), SizeType(str.size())); + } +#endif + bool EndObject(SizeType memberCount = 0) { (void)memberCount; RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level)); // not inside an Object