Repository navigation
Release 0.171.0
Enhancements:
-
basic_jsonsupports allocators that automatically propagate,-
std::pmr::polymorphic_allocator -
std::scoped_allocator_adaptor
-
-
Defines aliases and alias templates for
basic_jsonusing polymorphic allocators
in thejsoncons::pmrnamespace.
namespace jsoncons { namespace pmr {
template<class CharT, class Policy>
using basic_json = jsoncons::basic_json<CharT, Policy, std::pmr::polymorphic_allocator<char>>;
using json = basic_json<char,sorted_policy>;
using wjson = basic_json<wchar_t,sorted_policy>;
using ojson = basic_json<char, order_preserving_policy>;
using wojson = basic_json<wchar_t, order_preserving_policy>;
}}
-
Added a class
allocator_setfor holding an allocator for persistent data and an
allocator for temporary allocations. -
Added the ability to pass an
allocator_setobject to functionsbasic_json::parse,
decode_json,decode_csv,decode_bson,decode_cbor,decode_msgpack,decode_ubjson,
encode_json,encode_csv,encode_bson,encode_cbor,encode_msgpack,encode_ubjson. -
Added the ability to set a JSON parse error handler through options (rather than
as a separate parameter.) -
Added an error handler
allow_trailing_commas
Changes:
-
For users creating a custom
basic_jsonwith a user providedPolicy, the name
stringinPolicymust be changed tomember_key. -
Non-propagating stateful allocators are no longer supported.
Attempting to use a regular stateful allocator will produce a compile error.
Regular stateful allocators must be wrapped with std::scoped_allocator_adaptor -
Until 0.171.0, the
basic_jsonfunctionstry_emplace,emplace, andemplace_backallowed an allocator argument,
and one was required when using stateful allocators. Since 0.171.0,try_emplace,emplace, andemplace_back
must not be passed an allocator argument, because bothstd::pmr::polymorphic_allocatorandstd::scoped_allocator_adaptor
use uses-allocator construction.
Note: Non-stateful custom allocators are supported as before.
-
The tag type
result_allocator_arg_tand constantresult_allocator_arghave been deprecated. -
The
jsonpath::json_replacefunction no longer supports an optionalresult_optionsparameter. -
The order preserving versions of
basic_json,ojsonandwojson, no longer use indexes to
support search, but rely on sequential search instead. The feedback from users was that the additional
allocations and overhead wasn't worth any gains, particularly as the number of members in JSON
objects is typically not large.
Defect fixes
- Fixed issue danielaparker/jsoncons/#430 with
jsonpath::json_replace