-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
How to use a json::iterator dereferenced value in code? #1120
Comments
You want to use
|
I still get the same error when I do that... |
Which line is giving you the error? |
These three lines seem to trigger it individually, triggering 3 errors in total:
Actually, the error is technically at line 920 in file "xmemory0". The line is in this block ( I commented on the line with the error) :
File "xmemory0" is located at for me and is of type "FILE" (no extension...). |
Ah, you're inserting in a map, you want |
That solved it. Thank you! I wonder if its possible to throw better errors in a situation like this. It was not obvious to me that something like this could be the issue, and I thought the error was something else entirely... |
I don't think it's possible, as the error is that by using |
I am trying to do something like this - it involves taking a json::iterator through some json objects, and getting their keys and values for entries. I want to use the values (i.e. it.value() and mit.value()) as arguments to other functions...
When I build, I get the following error:
'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::basic_json(nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer> &&) noexcept': cannot convert argument 1 from 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' to 'std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>>>'
What is the correct way to access the value referenced by an iterator such that the value can be used by code?
The text was updated successfully, but these errors were encountered: