mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-11-29 22:36:19 +08:00
Extend rfl::AllowRawPtrs to std::string_view (#460)
This commit is contained in:
@@ -40,5 +40,14 @@ TEST(json, test_pointer_fields) {
|
||||
|
||||
delete homer.children;
|
||||
delete homer2.children;
|
||||
|
||||
// test string_view
|
||||
const std::string_view str = "wa oh what a coincidence";
|
||||
const auto json_str_view = rfl::json::write(str);
|
||||
const auto str_view_back =
|
||||
rfl::json::read<std::string_view, rfl::AllowRawPtrs>(json_str_view)
|
||||
.value();
|
||||
EXPECT_EQ(str, str_view_back);
|
||||
delete str_view_back.data();
|
||||
}
|
||||
} // namespace test_pointer_fields
|
||||
|
||||
Reference in New Issue
Block a user