YexuanXiao / basic_json

A modern C++ library for working with JSON data, aims to provide full support for the JSON standard, as well as allowing users to customize and extend the library according to their needs. The library offers a user-friendly and C++-idiomatic API, without compromising on performance.
Creative Commons Zero v1.0 Universal
8 stars 2 forks source link

Convert the Appendix to standard proposal #11

Closed frederick-vs-ja closed 3 months ago

frederick-vs-ja commented 3 months ago

There're many things changed to meet the standard wording style.

Many completion and changes in my mind:

YexuanXiao commented 3 months ago

Some functions of basic_json and basic_json_slice allocate memory, either directly or through the constructor of string_type. Should we document the exceptions that occur in these scenarios?

frederick-vs-ja commented 3 months ago

Some functions of basic_json and basic_json_slice allocate memory, either directly or through the constructor of string_type. Should we document the exceptions that occur in these scenarios?

I guess we should be just more precise on when and how allocator is used to allocate storage (for the stored object in the string, array, or object state). The actual exception thrown on allocation failure totally depends on the allocator ([allocator.requirements.general]).

The <json> paper doesn't seem responsible for documenting exception on allocation failure, which is possibly totally user-specified.

YexuanXiao commented 3 months ago

Some functions of basic_json and basic_json_slice allocate memory, either directly or through the constructor of string_type. Should we document the exceptions that occur in these scenarios?

I guess we should be just more precise on when and how allocator is used to allocate storage (for the stored object in the string, array, or object state). The actual exception thrown on allocation failure totally depends on the allocator ([allocator.requirements.general]).

The <json> paper doesn't seem responsible for documenting exception on allocation failure, which is possibly totally user-specified.

https://eel.is/c++draft/vector.modifiers#2 & https://eel.is/c++draft/vector.modifiers#4

frederick-vs-ja commented 3 months ago

The new commit should have addressed the concerns on throwing exceptions.