Skip to content

Commit 67b062b

Browse files
authored
Merge pull request Tencent#946 from hwiesmann/master
Add convenience method Key(std::basic_string<Ch> const&) to Writer
2 parents fe2b360 + 568107e commit 67b062b

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)