You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ambiguous overload for 'push_back' and 'operator+=' #235
The problem is that {"key", "value"} can be both interpreted as object_t::value_type or std::initializer_list<basic_json>. A solution could be to add an overload void push_back(std::initializer_list<basic_json>) and to create and object_t::value_type from that initializer list. First tries broke some tests, so I am not sure whether this will work in the end.
Activity
nlohmann commentedon Apr 19, 2016
I confirm the error. With clang 7.3.0 (clang-703.0.29), the error is a bit shorter (but basically the same):
gregmarr commentedon Apr 19, 2016
I wonder if having an emplace_back that chained to the vector version would be less ambiguous.
nlohmann commentedon May 8, 2016
The problem is that
{"key", "value"}can be both interpreted asobject_t::value_typeorstd::initializer_list<basic_json>. A solution could be to add an overloadvoid push_back(std::initializer_list<basic_json>)and to create andobject_t::value_typefrom that initializer list. First tries broke some tests, so I am not sure whether this will work in the end.working on #235
nlohmann commentedon May 8, 2016
Fixed with last commit to develop branch.
alestrooisma commentedon May 9, 2016
Can confirm that it is fixed. Thanks for the fix and the great library!