Add templated accessors for C string

This commit is contained in:
Milo Yip
2016-02-12 23:06:49 +08:00
2 changed files with 17 additions and 3 deletions

View File

@@ -768,6 +768,11 @@ TEST(Value, String) {
EXPECT_STREQ("World", w.GetString());
EXPECT_EQ(5u, w.GetStringLength());
// templated functions
EXPECT_TRUE(z.Is<const char*>());
EXPECT_STREQ(cstr, z.Get<const char*>());
EXPECT_STREQ("Apple", z.Set<const char*>("Apple").Get<const char*>());
#if RAPIDJSON_HAS_STDSTRING
{
std::string str = "Hello World";