Skip to content

Release 0.143.1

Choose a tag to compare

@danielaparker danielaparker released this 03 Jan 02:03
· 7604 commits to master since this release

Bug fix:

  • v0.143.1 fixs a bug in the jsonpath filter < comparison operator that was introduced in v0.143.0

Enhancements:

  • j.as<int>(), j.as<uint64_t>() etc. supported for binary, octal and hex string values,
    in addition to decimal string values.

  • Includes json_type_traits specialization for integer keyed maps, with conversion
    to/from string keys in a basic_json.

  • The json_type_traits specializations for type T generated by the convenience macros now include a specialization of
    is_json_type_traits_declared<T> with member constant value equal true.

  • New basic_json member function json_type type()

  • New basic_json member function get_value_or that gets a value as type T if available,
    or a default value if not:

    template <class T,class U>
    T get_value_or(const string_view_type& name, U&& default_value) const;

get_value_or is the preferred alternative to

template<class T>
T get_with_default(const string_view_type& name, const T& default_value) const

Note that get_value_or requires that the first template parameter T be specified explicitly (unlike get_with_default)

Changes:

  • The basic_json get_with_default(name) function, which returned a const reference
    to the value if available and to a json null constant if not,
    has been deprecated and renamed to at_or_null(name). Rationale: get_with_default(name)
    is more like at(name) (both return a const reference) than
    get_with_default(name,default_value) (which returns a value.)

  • The tag type bstr_arg_t has been renamed to byte_string_arg_t, and the constant
    bstr_arg to byte_string_arg.

  • The cbor_content_handler public member functions typed_array() and private virtual functions
    do_typed_array() have been moved to basic_json_content_handler. The do_typed_array()
    private virtual functions have been given default implementations. cbor_content_handler
    has been deprecated.

  • Replaced Martin Moene's span-lite with simpler implementation until std::span is available
    (primarily for typed array interface.)