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
Passing iterator pairs or pointer/length pairs to parsing functions (basic_json::parse, basic_json::accept, basic_json::sax_parse, basic_json::from_cbor, basic_json::from_msgpack, basic_json::from_ubjson, basic_json::from_bson) via initializer lists is deprecated. Instead, pass the elements individually without braces.
However, the pointer/length overload is marked as deprecated at least for the from_* functions:
My understanding of the release note wording is that e.g. from_cbor({ptr, len}) is deprecated, but that from_cbor(ptr, len) is the recommended alternative. But the second form is also deprecated.
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.
Sorry for not reacting earlier. In order to clean the API after a lot of experimenting with how to cope with different input types, we decided that the overload that takes two iterators is the one we would like to proceed with.
The release notes are indeed misleading. They should read:
This release deprecates passing iterator pairs or pointer/length pairs to parsing functions (basic_json::parse, basic_json::accept, basic_json::sax_parse, basic_json::from_cbor, basic_json::from_msgpack, basic_json::from_ubjson, basic_json::from_bson) via initializer lists. Instead, pass two iterators; for instance, call basic_json::from_cbor(ptr, ptr+len) instead of basic_json::from_cbor({ptr, len}).
@lrasinen@gregmarr Do you agree with the new wording of the last sentence?
Activity
nlohmann commentedon Oct 8, 2020
You mean the version number?
lrasinen commentedon Oct 8, 2020
My understanding of the release note wording is that e.g.
from_cbor({ptr, len})is deprecated, but thatfrom_cbor(ptr, len)is the recommended alternative. But the second form is also deprecated.gregmarr commentedon Oct 8, 2020
The recommended alternative is not
from_cbor(ptr, len)butfrom_cbor(ptr, ptr + len, ...).gregmarr commentedon Oct 8, 2020
@nlohmann Probably good to update the deprecation notice to include that one as well, as it's not really covered by the current note.
lrasinen commentedon Oct 8, 2020
Agreed. My experience with this was something like this:
I can (and do) use the ptr/ptr+len overload instead (although the ptr/len combo is quite convenient when applicable).
stale commentedon Dec 25, 2020
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.
nlohmann commentedon Dec 28, 2020
Sorry for not reacting earlier. In order to clean the API after a lot of experimenting with how to cope with different input types, we decided that the overload that takes two iterators is the one we would like to proceed with.
The release notes are indeed misleading. They should read:
@lrasinen @gregmarr Do you agree with the new wording of the last sentence?
lrasinen commentedon Dec 28, 2020
I'm quite happy with suggested wording, thanks.
nlohmann commentedon Dec 29, 2020
I adjusted the release notes of version 3.8.0, 3.9.0, and 3.9.1.
gregmarr commentedon Jan 4, 2021
LGTM