-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call of overloaded for push_back and operator+= is ambiguous #1352
Comments
I think the reason for the error is that the std :: pair type can be implicitly converted into two types: basic_json and object_t :: value_type. To solve this error, I suggest changing the name of the function json/include/nlohmann/json.hpp Line 4798 in da81e7b
to
In fact, the json :: object is not inserted at the end when inserting a new element. So the name of the function to insert the new element does not have to be push_back. I also think that the function name "insert ()" is better suited to the STL style because the json :: object type uses the std :: map type or the std :: unordered_map type as the container. But I can not think of a way to solve the ambiguity problem of operator + =. |
I've been waiting for an answer. |
Everything is fine - I just did not find the time to work on this. |
Okay. I will wait for an answer. Thanks for the reply. |
If you do not like the above solution, I suggest removing the to_json function for the std :: pair. I have confirmed that std :: pair is created as a json :: array. I also checked every test case. If you do not really need to convert 'std :: map' to 'json :: array', I think it is a good solution to remove the to_json function for std :: pair. You can use this feture by removing the to_json function for std :: pair:
also this :
I think this feature is much more useful than converting 'std :: map' to 'json :: array'. |
I do not think removing the Currently, If the key is not I believe the best thing to do is to fix |
I agree with @theodelrieu - removing support for |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
First, I'm sorry I can not speak English well.
English isn't my first language, so please excuse any mistakes.
When I try to insert a std :: pair using push_back() or operator+=(), a call ambiguous error occurs.
or
Compile error
error: call of overloaded ‘push_back(std::pair<std::__cxx11::basic_string<char>, bool>&)’ is ambiguous j.push_back(value);
GCC 7.3.0
Did i miss anything?
The text was updated successfully, but these errors were encountered: