On Mon, Jun 15, 2020 at 4:18 AM Andrzej Krzemienski 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 class ObjectType,
template class ArrayType,
class StringType,
class BooleanType,
class NumberIntegerType,
class NumberUnsignedType,
class NumberFloatType,
template<typename> class AllocatorType,
template class JSONSerializer
>
class basic_json
{
private:
....
friend ::nlohmann::detail::parser;
friend ::nlohmann::detail::serializer;
...
http://vinniefalco.github.io/doc/json/json/comparison.html#json.comparison.c...
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