Skip to content

Commit

Permalink
📝 fix links to cppreference named requirements
Browse files Browse the repository at this point in the history
"Concepts" have been renamed to "named requirements".
This is because P0898R3 Standard Library Concepts has been merged into
C++20.
Cppreference have moved their links accordingly.
  • Loading branch information
Julius Rakow committed Jun 24, 2018
1 parent 9f00db4 commit 963d06a
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 73 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**](https://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/named_req/ReversibleContainer) requirement.
```cpp
// create an array using push_back
Expand Down Expand Up @@ -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](https://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/named_req/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.
Expand Down Expand Up @@ -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](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:
There is a way, if your type is [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload:

```cpp
struct move_only_type {
Expand Down
2 changes: 1 addition & 1 deletion include/nlohmann/detail/iterators/iter_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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](https://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):
The iterator that can be moved can be moved in both directions (i.e.
incremented and decremented).
Expand Down
4 changes: 2 additions & 2 deletions include/nlohmann/detail/iterators/json_reverse_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ create @ref const_reverse_iterator).
@requirement The class satisfies the following concept requirements:
-
[BidirectionalIterator](https://en.cppreference.com/w/cpp/concept/BidirectionalIterator):
[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):
The iterator that can be moved can be moved in both directions (i.e.
incremented and decremented).
- [OutputIterator](https://en.cppreference.com/w/cpp/concept/OutputIterator):
- [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator):
It is possible to write to the pointed-to element (only if @a Base is
@ref iterator).
Expand Down
64 changes: 32 additions & 32 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,42 +101,42 @@ and `from_json()` (@ref adl_serializer by default)
@requirement The class satisfies the following concept requirements:
- Basic
- [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible):
- [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible):
JSON values can be default constructed. The result will be a JSON null
value.
- [MoveConstructible](https://en.cppreference.com/w/cpp/concept/MoveConstructible):
- [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible):
A JSON value can be constructed from an rvalue argument.
- [CopyConstructible](https://en.cppreference.com/w/cpp/concept/CopyConstructible):
- [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible):
A JSON value can be copy-constructed from an lvalue expression.
- [MoveAssignable](https://en.cppreference.com/w/cpp/concept/MoveAssignable):
- [MoveAssignable](https://en.cppreference.com/w/cpp/named_req/MoveAssignable):
A JSON value van be assigned from an rvalue argument.
- [CopyAssignable](https://en.cppreference.com/w/cpp/concept/CopyAssignable):
- [CopyAssignable](https://en.cppreference.com/w/cpp/named_req/CopyAssignable):
A JSON value can be copy-assigned from an lvalue expression.
- [Destructible](https://en.cppreference.com/w/cpp/concept/Destructible):
- [Destructible](https://en.cppreference.com/w/cpp/named_req/Destructible):
JSON values can be destructed.
- Layout
- [StandardLayoutType](https://en.cppreference.com/w/cpp/concept/StandardLayoutType):
- [StandardLayoutType](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType):
JSON values have
[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](https://en.cppreference.com/w/cpp/concept/EqualityComparable):
- [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable):
JSON values can be compared with `==`, see @ref
operator==(const_reference,const_reference).
- [LessThanComparable](https://en.cppreference.com/w/cpp/concept/LessThanComparable):
- [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable):
JSON values can be compared with `<`, see @ref
operator<(const_reference,const_reference).
- [Swappable](https://en.cppreference.com/w/cpp/concept/Swappable):
- [Swappable](https://en.cppreference.com/w/cpp/named_req/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](https://en.cppreference.com/w/cpp/concept/NullablePointer):
- [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer):
JSON values can be compared against `std::nullptr_t` objects which are used
to model the `null` value.
- Container
- [Container](https://en.cppreference.com/w/cpp/concept/Container):
- [Container](https://en.cppreference.com/w/cpp/named_req/Container):
JSON values can be used like STL containers and provide iterator access.
- [ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer);
- [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer);
JSON values can be used like STL containers and provide reverse iterator
access.
Expand Down Expand Up @@ -1735,7 +1735,7 @@ class basic_json
changes to any JSON value.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is linear.
- As postcondition, it holds: `other == basic_json(other)`.
Expand Down Expand Up @@ -1820,7 +1820,7 @@ class basic_json
exceptions.
@requirement This function helps `basic_json` satisfying the
[MoveConstructible](https://en.cppreference.com/w/cpp/concept/MoveConstructible)
[MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible)
requirements.
@liveexample{The code below shows the move constructor explicitly called
Expand Down Expand Up @@ -1854,7 +1854,7 @@ class basic_json
@complexity Linear.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is linear.
Expand Down Expand Up @@ -1891,7 +1891,7 @@ class basic_json
@complexity Linear.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is linear.
- All stored elements are destroyed and all memory is freed.
Expand Down Expand Up @@ -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](https://en.cppreference.com/w/cpp/concept/CopyConstructible)
and [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible).
which is [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)
and [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).
The value is converted by calling the @ref json_serializer<ValueType>
`from_json()` method.
Expand Down Expand Up @@ -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](https://en.cppreference.com/w/cpp/concept/CopyConstructible)
and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/concept/DefaultConstructible).
which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)
and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).
The value is converted by calling the @ref json_serializer<ValueType>
`from_json()` method.
Expand Down Expand Up @@ -3948,7 +3948,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is constant.
Expand Down Expand Up @@ -3987,7 +3987,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is constant.
- Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
Expand Down Expand Up @@ -4019,7 +4019,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is constant.
Expand Down Expand Up @@ -4058,7 +4058,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is constant.
- Has the semantics of `const_cast<const basic_json&>(*this).end()`.
Expand Down Expand Up @@ -4088,7 +4088,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
[ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
requirements:
- The complexity is constant.
- Has the semantics of `reverse_iterator(end())`.
Expand Down Expand Up @@ -4125,7 +4125,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
[ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
requirements:
- The complexity is constant.
- Has the semantics of `reverse_iterator(begin())`.
Expand Down Expand Up @@ -4162,7 +4162,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
[ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
requirements:
- The complexity is constant.
- Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
Expand Down Expand Up @@ -4191,7 +4191,7 @@ class basic_json
@complexity Constant.
@requirement This function helps `basic_json` satisfying the
[ReversibleContainer](https://en.cppreference.com/w/cpp/concept/ReversibleContainer)
[ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
requirements:
- The complexity is constant.
- Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
Expand Down Expand Up @@ -4389,7 +4389,7 @@ class basic_json
false in the case of a string.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is constant.
- Has the semantics of `begin() == end()`.
Expand Down Expand Up @@ -4460,7 +4460,7 @@ class basic_json
the case of a string.
@requirement This function helps `basic_json` satisfying the
[Container](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is constant.
- Has the semantics of `std::distance(begin(), end())`.
Expand Down Expand Up @@ -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](https://en.cppreference.com/w/cpp/concept/Container)
[Container](https://en.cppreference.com/w/cpp/named_req/Container)
requirements:
- The complexity is constant.
- Has the semantics of returning `b.size()` where `b` is the largest
Expand Down
Loading

0 comments on commit 963d06a

Please sign in to comment.