Skip to content

Commit 568107e

Browse files
author
Hartwig
committed
Add convenience method Key(std::basic_string<Ch> const&) to Writer
1 parent fe2b360 commit 568107e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/rapidjson/writer.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ class Writer {
222222

223223
bool Key(const Ch* str, SizeType length, bool copy = false) { return String(str, length, copy); }
224224

225+
#if RAPIDJSON_HAS_STDSTRING
226+
bool Key(const std::basic_string<Ch>& str)
227+
{
228+
return Key(str.data(), SizeType(str.size()));
229+
}
230+
#endif
231+
225232
bool EndObject(SizeType memberCount = 0) {
226233
(void)memberCount;
227234
RAPIDJSON_ASSERT(level_stack_.GetSize() >= sizeof(Level)); // not inside an Object

0 commit comments

Comments
 (0)