parser::parser
Constructors.
Synopsis
parser() noexcept; (1)
explicit
parser(
storage_ptr sp) noexcept; (2)
parser(
storage_ptr sp,
parse_options const& opt) noexcept; (3)
parser(
storage_ptr sp,
parse_options const& opt,
unsigned char* buffer,
std::size_t size) noexcept; (4)
template<
std::size_t N>
parser(
storage_ptr sp,
parse_options const& opt,
unsigned char (&buffer) [N]) noexcept; (5)
parser(
storage_ptr sp,
parse_options const& opt,
std::byte* buffer,
std::size_t size) noexcept; (6)
template<
std::size_t N>
parser(
storage_ptr sp,
parse_options const& opt,
std::byte (&buffer) [N]) noexcept; (7)
parser(
parser const&) = delete; (8)
Description
Construct a new parser.
The parser will only support standard JSON if overloads (1) or (2) are used. Otherwise the parser will support extensions specified by the parameter opt.
The parsed value will use the default memory resource for storage. To use a different resource, call reset after construction.
The main difference between the overloads is in what the constructed parser will use for temporary storage:
-
(1) the constructed parser uses the default memory resource for temporary storage.
-
(2), (3) the constructed parser uses the memory resource of
spfor temporary storage. -
(4), (6) the constructed parser first uses the caller-owned storage
[buffer, buffer + size)for temporary storage, falling back to the memory resource ofspif needed. -
(5), (7) the constructed parser first uses the caller-owned storage
[buffer, buffer + N)for temporary storage, falling back to the memory resource ofspif needed.
|
Ownership of |
Overload (8) is the copy constructor. The type is neither copyable nor movable, so the overload is deleted.
Complexity
Constant.
Exception Safety
No-throw guarantee.
Template Parameters
| Type | Description |
|---|---|
|
The number of valid bytes in |
Parameters
| Name | Description |
|---|---|
|
The memory resource to use for temporary storage. |
|
The parsing options to use. |
|
A pointer to valid storage. |
|
The number of valid bytes in |