Deprecate json_pointer/string_t comparisons (#3684)

* Deprecate json_pointer/string_t comparisons

* Update documentation
pull/3690/head
Florian Albrechtskirchinger 2022-08-07 22:26:59 +02:00 committed by GitHub
parent e1a3fb74ba
commit a92ccafd2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 2 deletions

View File

@ -71,6 +71,12 @@ whether the values `lhs`/`*this` and `rhs` are equal
Constant if `lhs` and `rhs` differ in the number of reference tokens, otherwise linear in the number of reference
tokens.
## Notes
!!! warning "Deprecation"
Overload 2 is deprecated and will be removed in a future major version release.
## Examples
??? example "Example: (1) Comparing JSON pointers"
@ -104,4 +110,4 @@ tokens.
## Version history
1. Added in version 2.1.0. Added C++20 member functions in version 3.11.2.
2. Added in version 3.11.2.
2. Added for backward compatibility and deprecated in version 3.11.2.

View File

@ -69,6 +69,10 @@ tokens.
Since C++20 overload resolution will consider the _rewritten candidate_ generated from
[`operator==`](operator_eq.md).
!!! warning "Deprecation"
Overload 2 is deprecated and will be removed in a future major version release.
## Examples
??? example "Example: (1) Comparing JSON pointers"
@ -102,4 +106,4 @@ tokens.
## Version history
1. Added in version 2.1.0.
2. Added in version 3.11.2.
2. Added for backward compatibility and deprecated in version 3.11.2.

View File

@ -858,6 +858,7 @@ class json_pointer
/// @brief compares JSON pointer and string for equality
/// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer))
bool operator==(const string_t& rhs) const
{
return *this == json_pointer(rhs);
@ -935,6 +936,7 @@ inline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeLhs,
typename StringType = typename json_pointer<RefStringTypeLhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))
inline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,
const StringType& rhs)
{
@ -943,6 +945,7 @@ inline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeRhs,
typename StringType = typename json_pointer<RefStringTypeRhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))
inline bool operator==(const StringType& lhs,
const json_pointer<RefStringTypeRhs>& rhs)
{
@ -958,6 +961,7 @@ inline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeLhs,
typename StringType = typename json_pointer<RefStringTypeLhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer))
inline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,
const StringType& rhs)
{
@ -966,6 +970,7 @@ inline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeRhs,
typename StringType = typename json_pointer<RefStringTypeRhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer))
inline bool operator!=(const StringType& lhs,
const json_pointer<RefStringTypeRhs>& rhs)
{

View File

@ -14518,6 +14518,7 @@ class json_pointer
/// @brief compares JSON pointer and string for equality
/// @sa https://json.nlohmann.me/api/json_pointer/operator_eq/
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer))
bool operator==(const string_t& rhs) const
{
return *this == json_pointer(rhs);
@ -14595,6 +14596,7 @@ inline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeLhs,
typename StringType = typename json_pointer<RefStringTypeLhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))
inline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,
const StringType& rhs)
{
@ -14603,6 +14605,7 @@ inline bool operator==(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeRhs,
typename StringType = typename json_pointer<RefStringTypeRhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator==(json_pointer, json_pointer))
inline bool operator==(const StringType& lhs,
const json_pointer<RefStringTypeRhs>& rhs)
{
@ -14618,6 +14621,7 @@ inline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeLhs,
typename StringType = typename json_pointer<RefStringTypeLhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer))
inline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,
const StringType& rhs)
{
@ -14626,6 +14630,7 @@ inline bool operator!=(const json_pointer<RefStringTypeLhs>& lhs,
template<typename RefStringTypeRhs,
typename StringType = typename json_pointer<RefStringTypeRhs>::string_t>
JSON_HEDLEY_DEPRECATED_FOR(3.11.2, operator!=(json_pointer, json_pointer))
inline bool operator!=(const StringType& lhs,
const json_pointer<RefStringTypeRhs>& rhs)
{