Release 0.171.0
Enhancements:
-
basic_json
supports allocators that automatically propagate,-
std::pmr::polymorphic_allocator
-
std::scoped_allocator_adaptor
-
-
Defines aliases and alias templates for
basic_json
using polymorphic allocators
in thejsoncons::pmr
namespace.
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_set
for holding an allocator for persistent data and an
allocator for temporary allocations. -
Added the ability to pass an
allocator_set
object 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_json
with a user providedPolicy
, the name
string
inPolicy
must 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_json
functionstry_emplace
,emplace
, andemplace_back
allowed 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_allocator
andstd::scoped_allocator_adaptor
use uses-allocator construction.
Note: Non-stateful custom allocators are supported as before.
-
The tag type
result_allocator_arg_t
and constantresult_allocator_arg
have been deprecated. -
The
jsonpath::json_replace
function no longer supports an optionalresult_options
parameter. -
The order preserving versions of
basic_json
,ojson
andwojson
, 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