mirror of
https://github.com/nlohmann/json.git
synced 2024-11-23 22:19:02 +08:00
📝 link to cppreference via HTTPS
This commit is contained in:
parent
62457729e8
commit
9f00db48d9
12
README.md
12
README.md
@ -288,7 +288,7 @@ json j = json::parse(v);
|
||||
|
||||
### STL-like access
|
||||
|
||||
We designed the JSON class to behave just like an STL container. In fact, it satisfies the [**ReversibleContainer**](http://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirement.
|
||||
We designed the JSON class to behave just like an STL container. In fact, it satisfies the [**ReversibleContainer**](https://en.cppreference.com/w/cpp/concept/ReversibleContainer) requirement.
|
||||
|
||||
```cpp
|
||||
// create an array using push_back
|
||||
@ -611,7 +611,7 @@ Some important things:
|
||||
|
||||
* Those methods **MUST** be in your type's namespace (which can be the global namespace), or the library will not be able to locate them (in this example, they are in namespace `ns`, where `person` is defined).
|
||||
* Those methods **MUST** be available (e.g., properly headers must be included) everywhere you use the implicit conversions. Look at [issue 1108](https://github.com/nlohmann/json/issues/1108) for errors that may occur otherwise.
|
||||
* When using `get<your_type>()`, `your_type` **MUST** be [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible). (There is a way to bypass this requirement described later.)
|
||||
* When using `get<your_type>()`, `your_type` **MUST** be [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible). (There is a way to bypass this requirement described later.)
|
||||
* In function `from_json`, use function [`at()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a93403e803947b86f4da2d1fb3345cf2c.html#a93403e803947b86f4da2d1fb3345cf2c) to access the object values rather than `operator[]`. In case a key does not exist, `at` throws an exception that you can handle, whereas `operator[]` exhibits undefined behavior.
|
||||
* In case your type contains several `operator=` definitions, code like `your_variable = your_json;` [may not compile](https://github.com/nlohmann/json/issues/667). You need to write `your_variable = your_json.get<decltype your_variable>();` instead.
|
||||
* You do not need to add serializers or deserializers for STL types like `std::vector`: the library already implements these.
|
||||
@ -623,7 +623,7 @@ Some important things:
|
||||
This requires a bit more advanced technique. But first, let's see how this conversion mechanism works:
|
||||
|
||||
The library uses **JSON Serializers** to convert types to json.
|
||||
The default serializer for `nlohmann::json` is `nlohmann::adl_serializer` (ADL means [Argument-Dependent Lookup](http://en.cppreference.com/w/cpp/language/adl)).
|
||||
The default serializer for `nlohmann::json` is `nlohmann::adl_serializer` (ADL means [Argument-Dependent Lookup](https://en.cppreference.com/w/cpp/language/adl)).
|
||||
|
||||
It is implemented like this (simplified):
|
||||
|
||||
@ -672,7 +672,7 @@ namespace nlohmann {
|
||||
|
||||
#### How can I use `get()` for non-default constructible/non-copyable types?
|
||||
|
||||
There is a way, if your type is [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload:
|
||||
There is a way, if your type is [MoveConstructible](https://en.cppreference.com/w/cpp/concept/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload:
|
||||
|
||||
```cpp
|
||||
struct move_only_type {
|
||||
@ -933,7 +933,7 @@ I deeply appreciate the help of the following people.
|
||||
- [Vladimir Petrigo](https://github.com/vpetrigo) made a SFINAE hack more readable and added Visual Studio 17 to the build matrix.
|
||||
- [Denis Andrejew](https://github.com/seeekr) fixed a grammar issue in the README file.
|
||||
- [Pierre-Antoine Lacaze](https://github.com/palacaze) found a subtle bug in the `dump()` function.
|
||||
- [TurpentineDistillery](https://github.com/TurpentineDistillery) pointed to [`std::locale::classic()`](http://en.cppreference.com/w/cpp/locale/locale/classic) to avoid too much locale joggling, found some nice performance improvements in the parser, improved the benchmarking code, and realized locale-independent number parsing and printing.
|
||||
- [TurpentineDistillery](https://github.com/TurpentineDistillery) pointed to [`std::locale::classic()`](https://en.cppreference.com/w/cpp/locale/locale/classic) to avoid too much locale joggling, found some nice performance improvements in the parser, improved the benchmarking code, and realized locale-independent number parsing and printing.
|
||||
- [cgzones](https://github.com/cgzones) had an idea how to fix the Coverity scan.
|
||||
- [Jared Grubb](https://github.com/jaredgrubb) silenced a nasty documentation warning.
|
||||
- [Yixin Zhang](https://github.com/qwename) fixed an integer overflow check.
|
||||
@ -1037,7 +1037,7 @@ The library is currently used in Apple macOS Sierra and iOS 10. I am not sure wh
|
||||
|
||||
## Notes
|
||||
|
||||
- The code contains numerous debug **assertions** which can be switched off by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](http://en.cppreference.com/w/cpp/error/assert). In particular, note [`operator[]`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a2e26bd0b0168abb61f67ad5bcd5b9fa1.html#a2e26bd0b0168abb61f67ad5bcd5b9fa1) implements **unchecked access** for const objects: If the given key is not present, the behavior is undefined (think of a dereferenced null pointer) and yields an [assertion failure](https://github.com/nlohmann/json/issues/289) if assertions are switched on. If you are not sure whether an element in an object exists, use checked access with the [`at()` function](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a674de1ee73e6bf4843fc5dc1351fb726.html#a674de1ee73e6bf4843fc5dc1351fb726).
|
||||
- The code contains numerous debug **assertions** which can be switched off by defining the preprocessor macro `NDEBUG`, see the [documentation of `assert`](https://en.cppreference.com/w/cpp/error/assert). In particular, note [`operator[]`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a2e26bd0b0168abb61f67ad5bcd5b9fa1.html#a2e26bd0b0168abb61f67ad5bcd5b9fa1) implements **unchecked access** for const objects: If the given key is not present, the behavior is undefined (think of a dereferenced null pointer) and yields an [assertion failure](https://github.com/nlohmann/json/issues/289) if assertions are switched on. If you are not sure whether an element in an object exists, use checked access with the [`at()` function](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a674de1ee73e6bf4843fc5dc1351fb726.html#a674de1ee73e6bf4843fc5dc1351fb726).
|
||||
- As the exact type of a number is not defined in the [JSON specification](http://rfc7159.net/rfc7159), this library tries to choose the best fitting C++ number type automatically. As a result, the type `double` may be used to store numbers which may yield [**floating-point exceptions**](https://github.com/nlohmann/json/issues/181) in certain rare situations if floating-point exceptions have been unmasked in the calling code. These exceptions are not caused by the library and need to be fixed in the calling code, such as by re-masking the exceptions prior to calling library functions.
|
||||
- The library supports **Unicode input** as follows:
|
||||
- Only **UTF-8** encoded input is supported which is the default encoding for JSON according to [RFC 7159](http://rfc7159.net/rfc7159#rfc.section.8.1).
|
||||
|
@ -887,7 +887,7 @@ void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)
|
||||
// numbers, all float's can be recovered using strtod (and strtof). However, the resulting
|
||||
// decimal representations are not exactly "short".
|
||||
//
|
||||
// The documentation for 'std::to_chars' (http://en.cppreference.com/w/cpp/utility/to_chars)
|
||||
// The documentation for 'std::to_chars' (https://en.cppreference.com/w/cpp/utility/to_chars)
|
||||
// says "value is converted to a string as if by std::sprintf in the default ("C") locale"
|
||||
// and since sprintf promotes float's to double's, I think this is exactly what 'std::to_chars'
|
||||
// does.
|
||||
|
@ -31,7 +31,7 @@ This class implements a both iterators (iterator and const_iterator) for the
|
||||
|
||||
@requirement The class satisfies the following concept requirements:
|
||||
-
|
||||
[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
[BidirectionalIterator](https://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
The iterator that can be moved can be moved in both directions (i.e.
|
||||
incremented and decremented).
|
||||
|
||||
|
@ -21,10 +21,10 @@ create @ref const_reverse_iterator).
|
||||
|
||||
@requirement The class satisfies the following concept requirements:
|
||||
-
|
||||
[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
[BidirectionalIterator](https://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
The iterator that can be moved can be moved in both directions (i.e.
|
||||
incremented and decremented).
|
||||
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
|
||||
- [OutputIterator](https://en.cppreference.com/w/cpp/concept/OutputIterator):
|
||||
It is possible to write to the pointed-to element (only if @a Base is
|
||||
@ref iterator).
|
||||
|
||||
|
@ -101,42 +101,42 @@ and `from_json()` (@ref adl_serializer by default)
|
||||
|
||||
@requirement The class satisfies the following concept requirements:
|
||||
- Basic
|
||||
- [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible):
|
||||
- [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible):
|
||||
JSON values can be default constructed. The result will be a JSON null
|
||||
value.
|
||||
- [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible):
|
||||
- [MoveConstructible](https://en.cppreference.com/w/cpp/concept/MoveConstructible):
|
||||
A JSON value can be constructed from an rvalue argument.
|
||||
- [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible):
|
||||
- [CopyConstructible](https://en.cppreference.com/w/cpp/concept/CopyConstructible):
|
||||
A JSON value can be copy-constructed from an lvalue expression.
|
||||
- [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable):
|
||||
- [MoveAssignable](https://en.cppreference.com/w/cpp/concept/MoveAssignable):
|
||||
A JSON value van be assigned from an rvalue argument.
|
||||
- [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable):
|
||||
- [CopyAssignable](https://en.cppreference.com/w/cpp/concept/CopyAssignable):
|
||||
A JSON value can be copy-assigned from an lvalue expression.
|
||||
- [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible):
|
||||
- [Destructible](https://en.cppreference.com/w/cpp/concept/Destructible):
|
||||
JSON values can be destructed.
|
||||
- Layout
|
||||
- [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType):
|
||||
- [StandardLayoutType](https://en.cppreference.com/w/cpp/concept/StandardLayoutType):
|
||||
JSON values have
|
||||
[standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
|
||||
[standard layout](https://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
|
||||
All non-static data members are private and standard layout types, the
|
||||
class has no virtual functions or (virtual) base classes.
|
||||
- Library-wide
|
||||
- [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable):
|
||||
- [EqualityComparable](https://en.cppreference.com/w/cpp/concept/EqualityComparable):
|
||||
JSON values can be compared with `==`, see @ref
|
||||
operator==(const_reference,const_reference).
|
||||
- [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable):
|
||||
- [LessThanComparable](https://en.cppreference.com/w/cpp/concept/LessThanComparable):
|
||||
JSON values can be compared with `<`, see @ref
|
||||
operator<(const_reference,const_reference).
|
||||
- [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable):
|
||||
- [Swappable](https://en.cppreference.com/w/cpp/concept/Swappable):
|
||||
Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of
|
||||
other compatible types, using unqualified function call @ref swap().
|
||||
- [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer):
|
||||
- [NullablePointer](https://en.cppreference.com/w/cpp/concept/NullablePointer):
|
||||
JSON values can be compared against `std::nullptr_t` objects which are used
|
||||
to model the `null` value.
|
||||
- Container
|
||||
- [Container](http://en.cppreference.com/w/cpp/concept/Container):
|
||||
- [Container](https://en.cppreference.com/w/cpp/concept/Container):
|
||||
JSON values can be used like STL containers and provide iterator access.
|
||||
- [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer);
|
||||
- [ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer);
|
||||
JSON values can be used like STL containers and provide reverse iterator
|
||||
access.
|
||||
|
||||
@ -1595,7 +1595,7 @@ class basic_json
|
||||
@warning A precondition is enforced with a runtime assertion that will
|
||||
result in calling `std::abort` if this precondition is not met.
|
||||
Assertions can be disabled by defining `NDEBUG` at compile time.
|
||||
See http://en.cppreference.com/w/cpp/error/assert for more
|
||||
See https://en.cppreference.com/w/cpp/error/assert for more
|
||||
information.
|
||||
|
||||
@throw invalid_iterator.201 if iterators @a first and @a last are not
|
||||
@ -1735,7 +1735,7 @@ class basic_json
|
||||
changes to any JSON value.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is linear.
|
||||
- As postcondition, it holds: `other == basic_json(other)`.
|
||||
@ -1820,7 +1820,7 @@ class basic_json
|
||||
exceptions.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible)
|
||||
[MoveConstructible](https://en.cppreference.com/w/cpp/concept/MoveConstructible)
|
||||
requirements.
|
||||
|
||||
@liveexample{The code below shows the move constructor explicitly called
|
||||
@ -1854,7 +1854,7 @@ class basic_json
|
||||
@complexity Linear.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is linear.
|
||||
|
||||
@ -1891,7 +1891,7 @@ class basic_json
|
||||
@complexity Linear.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is linear.
|
||||
- All stored elements are destroyed and all memory is freed.
|
||||
@ -2522,8 +2522,8 @@ class basic_json
|
||||
@brief get a value (explicit)
|
||||
|
||||
Explicit type conversion between the JSON value and a compatible value
|
||||
which is [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
which is [CopyConstructible](https://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
The value is converted by calling the @ref json_serializer<ValueType>
|
||||
`from_json()` method.
|
||||
|
||||
@ -2583,8 +2583,8 @@ class basic_json
|
||||
@brief get a value (explicit); special case
|
||||
|
||||
Explicit type conversion between the JSON value and a compatible value
|
||||
which is **not** [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and **not** [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
The value is converted by calling the @ref json_serializer<ValueType>
|
||||
`from_json()` method.
|
||||
|
||||
@ -3948,7 +3948,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
|
||||
@ -3987,7 +3987,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
|
||||
@ -4019,7 +4019,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
|
||||
@ -4058,7 +4058,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).end()`.
|
||||
@ -4088,7 +4088,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `reverse_iterator(end())`.
|
||||
@ -4125,7 +4125,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `reverse_iterator(begin())`.
|
||||
@ -4162,7 +4162,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
|
||||
@ -4191,7 +4191,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
|
||||
@ -4389,7 +4389,7 @@ class basic_json
|
||||
false in the case of a string.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `begin() == end()`.
|
||||
@ -4460,7 +4460,7 @@ class basic_json
|
||||
the case of a string.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `std::distance(begin(), end())`.
|
||||
@ -4530,7 +4530,7 @@ class basic_json
|
||||
@exceptionsafety No-throw guarantee: this function never throws exceptions.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of returning `b.size()` where `b` is the largest
|
||||
|
@ -18,7 +18,7 @@ namespace nlohmann
|
||||
@brief default JSONSerializer template argument
|
||||
|
||||
This serializer ignores the template arguments and uses ADL
|
||||
([argument-dependent lookup](http://en.cppreference.com/w/cpp/language/adl))
|
||||
([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
|
||||
for serialization.
|
||||
*/
|
||||
template<typename T = void, typename SFINAE = void>
|
||||
|
@ -67,7 +67,7 @@ namespace nlohmann
|
||||
@brief default JSONSerializer template argument
|
||||
|
||||
This serializer ignores the template arguments and uses ADL
|
||||
([argument-dependent lookup](http://en.cppreference.com/w/cpp/language/adl))
|
||||
([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
|
||||
for serialization.
|
||||
*/
|
||||
template<typename T = void, typename SFINAE = void>
|
||||
@ -4740,7 +4740,7 @@ This class implements a both iterators (iterator and const_iterator) for the
|
||||
|
||||
@requirement The class satisfies the following concept requirements:
|
||||
-
|
||||
[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
[BidirectionalIterator](https://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
The iterator that can be moved can be moved in both directions (i.e.
|
||||
incremented and decremented).
|
||||
|
||||
@ -5460,10 +5460,10 @@ create @ref const_reverse_iterator).
|
||||
|
||||
@requirement The class satisfies the following concept requirements:
|
||||
-
|
||||
[BidirectionalIterator](http://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
[BidirectionalIterator](https://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
|
||||
The iterator that can be moved can be moved in both directions (i.e.
|
||||
incremented and decremented).
|
||||
- [OutputIterator](http://en.cppreference.com/w/cpp/concept/OutputIterator):
|
||||
- [OutputIterator](https://en.cppreference.com/w/cpp/concept/OutputIterator):
|
||||
It is possible to write to the pointed-to element (only if @a Base is
|
||||
@ref iterator).
|
||||
|
||||
@ -9233,7 +9233,7 @@ void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)
|
||||
// numbers, all float's can be recovered using strtod (and strtof). However, the resulting
|
||||
// decimal representations are not exactly "short".
|
||||
//
|
||||
// The documentation for 'std::to_chars' (http://en.cppreference.com/w/cpp/utility/to_chars)
|
||||
// The documentation for 'std::to_chars' (https://en.cppreference.com/w/cpp/utility/to_chars)
|
||||
// says "value is converted to a string as if by std::sprintf in the default ("C") locale"
|
||||
// and since sprintf promotes float's to double's, I think this is exactly what 'std::to_chars'
|
||||
// does.
|
||||
@ -10907,42 +10907,42 @@ and `from_json()` (@ref adl_serializer by default)
|
||||
|
||||
@requirement The class satisfies the following concept requirements:
|
||||
- Basic
|
||||
- [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible):
|
||||
- [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible):
|
||||
JSON values can be default constructed. The result will be a JSON null
|
||||
value.
|
||||
- [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible):
|
||||
- [MoveConstructible](https://en.cppreference.com/w/cpp/concept/MoveConstructible):
|
||||
A JSON value can be constructed from an rvalue argument.
|
||||
- [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible):
|
||||
- [CopyConstructible](https://en.cppreference.com/w/cpp/concept/CopyConstructible):
|
||||
A JSON value can be copy-constructed from an lvalue expression.
|
||||
- [MoveAssignable](http://en.cppreference.com/w/cpp/concept/MoveAssignable):
|
||||
- [MoveAssignable](https://en.cppreference.com/w/cpp/concept/MoveAssignable):
|
||||
A JSON value van be assigned from an rvalue argument.
|
||||
- [CopyAssignable](http://en.cppreference.com/w/cpp/concept/CopyAssignable):
|
||||
- [CopyAssignable](https://en.cppreference.com/w/cpp/concept/CopyAssignable):
|
||||
A JSON value can be copy-assigned from an lvalue expression.
|
||||
- [Destructible](http://en.cppreference.com/w/cpp/concept/Destructible):
|
||||
- [Destructible](https://en.cppreference.com/w/cpp/concept/Destructible):
|
||||
JSON values can be destructed.
|
||||
- Layout
|
||||
- [StandardLayoutType](http://en.cppreference.com/w/cpp/concept/StandardLayoutType):
|
||||
- [StandardLayoutType](https://en.cppreference.com/w/cpp/concept/StandardLayoutType):
|
||||
JSON values have
|
||||
[standard layout](http://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
|
||||
[standard layout](https://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
|
||||
All non-static data members are private and standard layout types, the
|
||||
class has no virtual functions or (virtual) base classes.
|
||||
- Library-wide
|
||||
- [EqualityComparable](http://en.cppreference.com/w/cpp/concept/EqualityComparable):
|
||||
- [EqualityComparable](https://en.cppreference.com/w/cpp/concept/EqualityComparable):
|
||||
JSON values can be compared with `==`, see @ref
|
||||
operator==(const_reference,const_reference).
|
||||
- [LessThanComparable](http://en.cppreference.com/w/cpp/concept/LessThanComparable):
|
||||
- [LessThanComparable](https://en.cppreference.com/w/cpp/concept/LessThanComparable):
|
||||
JSON values can be compared with `<`, see @ref
|
||||
operator<(const_reference,const_reference).
|
||||
- [Swappable](http://en.cppreference.com/w/cpp/concept/Swappable):
|
||||
- [Swappable](https://en.cppreference.com/w/cpp/concept/Swappable):
|
||||
Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of
|
||||
other compatible types, using unqualified function call @ref swap().
|
||||
- [NullablePointer](http://en.cppreference.com/w/cpp/concept/NullablePointer):
|
||||
- [NullablePointer](https://en.cppreference.com/w/cpp/concept/NullablePointer):
|
||||
JSON values can be compared against `std::nullptr_t` objects which are used
|
||||
to model the `null` value.
|
||||
- Container
|
||||
- [Container](http://en.cppreference.com/w/cpp/concept/Container):
|
||||
- [Container](https://en.cppreference.com/w/cpp/concept/Container):
|
||||
JSON values can be used like STL containers and provide iterator access.
|
||||
- [ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer);
|
||||
- [ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer);
|
||||
JSON values can be used like STL containers and provide reverse iterator
|
||||
access.
|
||||
|
||||
@ -12401,7 +12401,7 @@ class basic_json
|
||||
@warning A precondition is enforced with a runtime assertion that will
|
||||
result in calling `std::abort` if this precondition is not met.
|
||||
Assertions can be disabled by defining `NDEBUG` at compile time.
|
||||
See http://en.cppreference.com/w/cpp/error/assert for more
|
||||
See https://en.cppreference.com/w/cpp/error/assert for more
|
||||
information.
|
||||
|
||||
@throw invalid_iterator.201 if iterators @a first and @a last are not
|
||||
@ -12541,7 +12541,7 @@ class basic_json
|
||||
changes to any JSON value.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is linear.
|
||||
- As postcondition, it holds: `other == basic_json(other)`.
|
||||
@ -12626,7 +12626,7 @@ class basic_json
|
||||
exceptions.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible)
|
||||
[MoveConstructible](https://en.cppreference.com/w/cpp/concept/MoveConstructible)
|
||||
requirements.
|
||||
|
||||
@liveexample{The code below shows the move constructor explicitly called
|
||||
@ -12660,7 +12660,7 @@ class basic_json
|
||||
@complexity Linear.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is linear.
|
||||
|
||||
@ -12697,7 +12697,7 @@ class basic_json
|
||||
@complexity Linear.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is linear.
|
||||
- All stored elements are destroyed and all memory is freed.
|
||||
@ -13328,8 +13328,8 @@ class basic_json
|
||||
@brief get a value (explicit)
|
||||
|
||||
Explicit type conversion between the JSON value and a compatible value
|
||||
which is [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
which is [CopyConstructible](https://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
The value is converted by calling the @ref json_serializer<ValueType>
|
||||
`from_json()` method.
|
||||
|
||||
@ -13389,8 +13389,8 @@ class basic_json
|
||||
@brief get a value (explicit); special case
|
||||
|
||||
Explicit type conversion between the JSON value and a compatible value
|
||||
which is **not** [CopyConstructible](http://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and **not** [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/concept/CopyConstructible)
|
||||
and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible).
|
||||
The value is converted by calling the @ref json_serializer<ValueType>
|
||||
`from_json()` method.
|
||||
|
||||
@ -14754,7 +14754,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
|
||||
@ -14793,7 +14793,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
|
||||
@ -14825,7 +14825,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
|
||||
@ -14864,7 +14864,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).end()`.
|
||||
@ -14894,7 +14894,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `reverse_iterator(end())`.
|
||||
@ -14931,7 +14931,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `reverse_iterator(begin())`.
|
||||
@ -14968,7 +14968,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
|
||||
@ -14997,7 +14997,7 @@ class basic_json
|
||||
@complexity Constant.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[ReversibleContainer](http://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
|
||||
@ -15195,7 +15195,7 @@ class basic_json
|
||||
false in the case of a string.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `begin() == end()`.
|
||||
@ -15266,7 +15266,7 @@ class basic_json
|
||||
the case of a string.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of `std::distance(begin(), end())`.
|
||||
@ -15336,7 +15336,7 @@ class basic_json
|
||||
@exceptionsafety No-throw guarantee: this function never throws exceptions.
|
||||
|
||||
@requirement This function helps `basic_json` satisfying the
|
||||
[Container](http://en.cppreference.com/w/cpp/concept/Container)
|
||||
[Container](https://en.cppreference.com/w/cpp/concept/Container)
|
||||
requirements:
|
||||
- The complexity is constant.
|
||||
- Has the semantics of returning `b.size()` where `b` is the largest
|
||||
|
@ -33,7 +33,7 @@ SOFTWARE.
|
||||
using nlohmann::json;
|
||||
|
||||
// helper function to check std::less<json::value_t>
|
||||
// see http://en.cppreference.com/w/cpp/utility/functional/less
|
||||
// see https://en.cppreference.com/w/cpp/utility/functional/less
|
||||
template <typename A, typename B, typename U = std::less<json::value_t>>
|
||||
bool f(A a, B b, U u = U())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user