Skip to content

Release 0.171.0

Compare
Choose a tag to compare
@danielaparker danielaparker released this 07 Jul 21:35
· 1349 commits to master since this release

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 the jsoncons::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 functions basic_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 provided Policy, the name
    string in Policy must be changed to member_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 functions try_emplace, emplace, and emplace_back allowed an allocator argument,
    and one was required when using stateful allocators. Since 0.171.0, try_emplace, emplace, and emplace_back
    must not be passed an allocator argument, because both std::pmr::polymorphic_allocator and std::scoped_allocator_adaptor
    use uses-allocator construction.

Note: Non-stateful custom allocators are supported as before.

  • The tag type result_allocator_arg_t and constant result_allocator_arg have been deprecated.

  • The jsonpath::json_replace function no longer supports an optional result_options parameter.

  • The order preserving versions of basic_json, ojson and wojson, 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