@@ -44,13 +44,13 @@ struct Comparator
44
44
45
45
bool operator ()(const Object &lhs, const Object &rhs) const
46
46
{
47
- std::set<std::string > lhs_keys;
47
+ std::set<std::string_view > lhs_keys;
48
48
for (const auto &key_value : lhs.values )
49
49
{
50
50
lhs_keys.insert (key_value.first );
51
51
}
52
52
53
- std::set<std::string > rhs_keys;
53
+ std::set<std::string_view > rhs_keys;
54
54
for (const auto &key_value : rhs.values )
55
55
{
56
56
rhs_keys.insert (key_value.first );
@@ -60,7 +60,7 @@ struct Comparator
60
60
{
61
61
if (rhs_keys.find (key) == rhs_keys.end ())
62
62
{
63
- reason = rhs_path + " doesn't have key \" " + key + " \" " ;
63
+ reason = rhs_path + " doesn't have key \" " + std::string ( key) + " \" " ;
64
64
return false ;
65
65
}
66
66
}
@@ -69,7 +69,7 @@ struct Comparator
69
69
{
70
70
if (lhs_keys.find (key) == lhs_keys.end ())
71
71
{
72
- reason = lhs_path + " doesn't have key \" " + key + " \" " ;
72
+ reason = lhs_path + " doesn't have key \" " + std::string ( key) + " \" " ;
73
73
return false ;
74
74
}
75
75
}
@@ -81,10 +81,11 @@ struct Comparator
81
81
82
82
const auto &rhs_child = rhs.values .find (key)->second ;
83
83
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);
88
89
if (!is_same)
89
90
{
90
91
return false ;
0 commit comments