Change string copy policy: only string literal are stored by pointer

This commit is contained in:
Benoit Blanchon
2024-11-25 12:25:59 +01:00
parent 5f8e3c0f0f
commit 594dc707cb
27 changed files with 456 additions and 197 deletions
@@ -139,7 +139,8 @@ TEST_CASE("serialize MsgPack value") {
SECTION("str 32") {
std::string shortest(65536, '?');
checkVariant(shortest.c_str(), "\xDB\x00\x01\x00\x00"_s + shortest);
checkVariant(JsonString(shortest.c_str(), true), // force store by pointer
"\xDB\x00\x01\x00\x00"_s + shortest);
}
SECTION("serialized(const char*)") {