🔨 fixed compilation errors

TIL about C++:

executing m[key()]=val(); for a std::map executes

First key() then val() with Clang

First val() then key() with GCC

#wat
This commit is contained in:
Niels Lohmann 2017-04-03 21:53:23 +02:00
parent 89efe627fe
commit ea667db446
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69

View file

@ -10722,7 +10722,8 @@ class basic_json
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
{ {
get(); get();
result[get_cbor_string()] = parse_cbor(); auto key = get_cbor_string();
result[key] = parse_cbor();
} }
return result; return result;
} }
@ -10734,7 +10735,8 @@ class basic_json
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
{ {
get(); get();
result[get_cbor_string()] = parse_cbor(); auto key = get_cbor_string();
result[key] = parse_cbor();
} }
return result; return result;
} }
@ -10746,7 +10748,8 @@ class basic_json
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
{ {
get(); get();
result[get_cbor_string()] = parse_cbor(); auto key = get_cbor_string();
result[key] = parse_cbor();
} }
return result; return result;
} }
@ -10758,7 +10761,8 @@ class basic_json
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
{ {
get(); get();
result[get_cbor_string()] = parse_cbor(); auto key = get_cbor_string();
result[key] = parse_cbor();
} }
return result; return result;
} }
@ -10770,7 +10774,8 @@ class basic_json
for (size_t i = 0; i < len; ++i) for (size_t i = 0; i < len; ++i)
{ {
get(); get();
result[get_cbor_string()] = parse_cbor(); auto key = get_cbor_string();
result[key] = parse_cbor();
} }
return result; return result;
} }
@ -10780,7 +10785,8 @@ class basic_json
basic_json result = value_t::object; basic_json result = value_t::object;
while (get() != 0xff) while (get() != 0xff)
{ {
result[get_cbor_string()] = parse_cbor(); auto key = get_cbor_string();
result[key] = parse_cbor();
} }
return result; return result;
} }