Boost logo

Boost Users :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2020-06-17 01:27:50


On Mon, Jun 15, 2020 at 4:18 AM Andrzej Krzemienski <akrzemi1_at_[hidden]> wrote:
> can they use their string in Boost.JSON?

No. The design of the library explicitly avoids allowing customizability.

> It should be possible to parametrize Boost.JSON with the string type.

This has been explored in other libraries, and I don't like the
result. Here is nlohmann JSON's value type:

template<
        template<typename, typename, typename...> class ObjectType,
        template<typename, typename...> class ArrayType,
        class StringType,
        class BooleanType,
        class NumberIntegerType,
        class NumberUnsignedType,
        class NumberFloatType,
        template<typename> class AllocatorType,
        template<typename, typename = void> class JSONSerializer
>
    class basic_json
    {
      private:
        ....
        friend ::nlohmann::detail::parser<basic_json>;
        friend ::nlohmann::detail::serializer<basic_json>;
    ...

<http://vinniefalco.github.io/doc/json/json/comparison.html#json.comparison.comparison_to_nlohmann_json>

Thanks, but no thanks.

As I said the library achieves its performance partly due to the
layout of the different types used in the discriminated union, of
which string is one. Users aren't asking for "using their own string
type in the JSON DOM." What they want is the speed of RapidJSON,
options for skipping comments, allowing trailing commas, and flexible
parsing, and the interface quality of a Boost library.

Thanks


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net