74 lines
2.5 KiB
Plaintext
74 lines
2.5 KiB
Plaintext
[/
|
|
Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
Official repository: https://github.com/cppalliance/json
|
|
]
|
|
|
|
[/-----------------------------------------------------------------------------]
|
|
|
|
[section Frequently Asked Questions]
|
|
|
|
[variablelist
|
|
|
|
[[
|
|
"Isn't simdjson faster?"
|
|
][
|
|
These libraries are not comparable.
|
|
The output of the simdjson parser is a read-only structure.
|
|
In other words, it can't be changed, and the only way to create one is
|
|
by parsing a JSON string. On the other hand, Boost.JSON allows you to
|
|
modify the container holding the parsed JSON, or even build a JSON
|
|
document from scratch through the container interface.
|
|
]]
|
|
|
|
[[
|
|
"I want to parse directly into my own data structures"
|
|
][
|
|
The purpose of this library is to enable algorithms which implement
|
|
JSON functionality in their public interfaces to be interoperable,
|
|
by providing a __value__ type that meets the bar for vocabulary
|
|
type suitability. Parsing directly into a user defined type offers
|
|
some advantages but is not the goal of the library. However, users
|
|
who wish to parse directly into their own types may implement a
|
|
custom handler for this purpose.
|
|
]]
|
|
|
|
[[
|
|
"Why not use a standard __Allocator__?"
|
|
][
|
|
Using standard allocators would require that __value__ be declared
|
|
as a class template, which would impose an additional compilation
|
|
burden. By avoiding the template, most of the function definitions
|
|
in the library can be excluded from the headers and emitted in a
|
|
separate static or dynamic library.
|
|
]]
|
|
|
|
[[
|
|
"Why use __storage_ptr__ over __polymorphic_allocator__?
|
|
][
|
|
__polymorphic_allocator__ treats the memory resource as a reference
|
|
with respect to ownership. Boost.JSON uses a reference counted
|
|
smart pointer container to simplify the lifetime management of
|
|
memory resources. In addition to being reference counted,
|
|
__storage_ptr__ can function as an uncounted reference wrapper
|
|
around a __memory_resource__.
|
|
]]
|
|
|
|
[[
|
|
"Why __string__ instead of __std_string__?"
|
|
][
|
|
The string provided by the library uses the __storage_ptr__
|
|
allocator model, has the same interface on all C++ versions,
|
|
and has an optimized class layout to keep the size of JSON
|
|
values small. __string__ also implements an improved interface
|
|
that replaces extraneous overloads with ones that
|
|
use __string_view__.
|
|
]]
|
|
|
|
]
|
|
|
|
[endsect]
|