@@ -44,13 +44,13 @@ struct Comparator
4444
4545 bool operator ()(const Object &lhs, const Object &rhs) const
4646 {
47- std::set<std::string > lhs_keys;
47+ std::set<std::string_view > lhs_keys;
4848 for (const auto &key_value : lhs.values )
4949 {
5050 lhs_keys.insert (key_value.first );
5151 }
5252
53- std::set<std::string > rhs_keys;
53+ std::set<std::string_view > rhs_keys;
5454 for (const auto &key_value : rhs.values )
5555 {
5656 rhs_keys.insert (key_value.first );
@@ -60,7 +60,7 @@ struct Comparator
6060 {
6161 if (rhs_keys.find (key) == rhs_keys.end ())
6262 {
63- reason = rhs_path + " doesn't have key \" " + key + " \" " ;
63+ reason = rhs_path + " doesn't have key \" " + std::string ( key) + " \" " ;
6464 return false ;
6565 }
6666 }
@@ -69,7 +69,7 @@ struct Comparator
6969 {
7070 if (lhs_keys.find (key) == lhs_keys.end ())
7171 {
72- reason = lhs_path + " doesn't have key \" " + key + " \" " ;
72+ reason = lhs_path + " doesn't have key \" " + std::string ( key) + " \" " ;
7373 return false ;
7474 }
7575 }
@@ -81,10 +81,11 @@ struct Comparator
8181
8282 const auto &rhs_child = rhs.values .find (key)->second ;
8383 const auto &lhs_child = lhs.values .find (key)->second ;
84- auto is_same =
85- std::visit (Comparator (reason, lhs_path + " ." + key, rhs_path + " ." + key),
86- lhs_child,
87- rhs_child);
84+ auto is_same = std::visit (Comparator (reason,
85+ lhs_path + " ." + std::string (key),
86+ rhs_path + " ." + std::string (key)),
87+ lhs_child,
88+ rhs_child);
8889 if (!is_same)
8990 {
9091 return false ;
0 commit comments