Skip to content

Beginners luck running out - help needed accessing values. #102

Answered by ColinH
gazzatav asked this question in Q&A
Discussion options

You must be logged in to vote

Why is meta_iter valid as a pointer (can compare to nullptr) but ver_iter is not? Thought value v would be a map (like meta).

While meta is indeed a std::map< std::string, tao::json::value >, so the iterators are the usual map iterators, the problem is that v is a tao::json::value which can hold an object (map), an array (vector), or one of the many other values, so there is no clear candidate for what tao::json::value::iterator should be, and how it should behave.

For this reason the various tao::json::value::find() functions return a pointer to a tao::json::value that is nullptr when no appropriate sub-value was found (for objects the search key must be a string, for arrays the search…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by gazzatav
Comment options

You must be logged in to vote
2 replies
@gazzatav
Comment options

@ColinH
Comment options

Comment options

You must be logged in to vote
1 reply
@gazzatav
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants