-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34284c3
commit f144f38
Showing
5 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[/ | ||
Copyright (c) 2023 Dmitry Arkhipov ([email protected]) | ||
|
||
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/boostorg/json | ||
] | ||
|
||
[/-----------------------------------------------------------------------------] | ||
|
||
|
||
[section Direct parsing] | ||
|
||
For large inputs parsing into the library's containers followed by conversion | ||
via __value_to__ might be prohibitively expensive. For this cases the library | ||
provides components that allow parsing directly into user-provided objects. | ||
|
||
The drawback of this approach is that fully custom type representations are | ||
not supported, only the library-provided conversions are. Also all objects that | ||
should be populated by parsing have to be default constructible types. This | ||
includes not only the top-level object, but e.g. elements of containers, | ||
members of described `struct`s, and alternatives of variants. | ||
|
||
That being said, if your types are default-constructible and you don't need | ||
the customisability allowed by __value_to__, then you can get a significant | ||
performance boost with direct parsing. | ||
|
||
Direct parsing is performed by the __parse_into__ family of functions. The | ||
library provides overloads that take either __string_view__ or `std::istream`, | ||
and can report errors either via throwing exceptions or setting an error code. | ||
|
||
[doc_parse_into_1] | ||
|
||
Finally, if you need to combine incremental parsing with direct parsing, you | ||
can resort to __parser_for__. `parser_for<T>` is an instantiation of | ||
__basic_parser__ that parses into an object of type `T`, and is what | ||
__parse_into__ uses under the hood. | ||
|
||
[endsect] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters