From 7461a199b5ca4d7e43d463c7acee9256f481b04d Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 13 Oct 2026 20:06:14 +0200 Subject: [PATCH] Drop the class wrapper from the C++20 comparison operator signatures in the docs (#5814) * Drop the class wrapper from the C++20 comparison operator signatures in the docs The signature boxes of operator<=> and the C++20 half of operator== wrapped the member declarations in an incomplete "class basic_json { ... };". The trailing const already marks them as members, and no other page uses such a wrapper. Signed-off-by: Niels Lohmann * Drop the class wrapper from the json_pointer comparison signatures too Signed-off-by: Niels Lohmann --------- Signed-off-by: Niels Lohmann --- docs/mkdocs/docs/api/basic_json/operator_eq.md | 8 +++----- docs/mkdocs/docs/api/basic_json/operator_spaceship.md | 8 +++----- docs/mkdocs/docs/api/json_pointer/operator_eq.md | 10 ++++------ .../mkdocs/docs/api/json_pointer/operator_spaceship.md | 6 ++---- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/docs/mkdocs/docs/api/basic_json/operator_eq.md b/docs/mkdocs/docs/api/basic_json/operator_eq.md index 58a7e74da..006b1ac4c 100644 --- a/docs/mkdocs/docs/api/basic_json/operator_eq.md +++ b/docs/mkdocs/docs/api/basic_json/operator_eq.md @@ -11,12 +11,10 @@ template bool operator==(ScalarType lhs, const const_reference rhs) noexcept(/* see below */); // (2) // since C++20 -class basic_json { - bool operator==(const_reference rhs) const noexcept; // (1) +bool operator==(const_reference rhs) const noexcept; // (1) - template - bool operator==(ScalarType rhs) const noexcept(/* see below */); // (2) -}; +template +bool operator==(ScalarType rhs) const noexcept(/* see below */); // (2) ``` 1. Compares two JSON values for equality according to the following rules: diff --git a/docs/mkdocs/docs/api/basic_json/operator_spaceship.md b/docs/mkdocs/docs/api/basic_json/operator_spaceship.md index 47ca22484..73c831e84 100644 --- a/docs/mkdocs/docs/api/basic_json/operator_spaceship.md +++ b/docs/mkdocs/docs/api/basic_json/operator_spaceship.md @@ -2,12 +2,10 @@ ```cpp // since C++20 -class basic_json { - std::partial_ordering operator<=>(const_reference rhs) const noexcept; // (1) +std::partial_ordering operator<=>(const_reference rhs) const noexcept; // (1) - template - std::partial_ordering operator<=>(const ScalarType rhs) const noexcept(/* see below */); // (2) -}; +template +std::partial_ordering operator<=>(const ScalarType rhs) const noexcept(/* see below */); // (2) ``` 1. 3-way compares two JSON values producing a result of type `std::partial_ordering` according to the following rules: diff --git a/docs/mkdocs/docs/api/json_pointer/operator_eq.md b/docs/mkdocs/docs/api/json_pointer/operator_eq.md index a9f40891f..44cda4354 100644 --- a/docs/mkdocs/docs/api/json_pointer/operator_eq.md +++ b/docs/mkdocs/docs/api/json_pointer/operator_eq.md @@ -18,13 +18,11 @@ bool operator==( const json_pointer& rhs); // (2) // since C++20 -class json_pointer { - template - bool operator==( - const json_pointer& rhs) const noexcept; // (1) +template +bool operator==( + const json_pointer& rhs) const noexcept; // (1) - bool operator==(const string_t& rhs) const; // (2) -}; +bool operator==(const string_t& rhs) const; // (2) ``` 1. Compares two JSON pointers for equality by comparing their reference tokens. diff --git a/docs/mkdocs/docs/api/json_pointer/operator_spaceship.md b/docs/mkdocs/docs/api/json_pointer/operator_spaceship.md index 2ec917b72..ffc3f0e93 100644 --- a/docs/mkdocs/docs/api/json_pointer/operator_spaceship.md +++ b/docs/mkdocs/docs/api/json_pointer/operator_spaceship.md @@ -2,10 +2,8 @@ ```cpp // since C++20 -class json_pointer { - template - std::strong_ordering operator<=>(const json_pointer& rhs) const noexcept; // *NOPAD* -}; +template +std::strong_ordering operator<=>(const json_pointer& rhs) const noexcept; // *NOPAD* ``` 3-way compares two JSON pointers by lexicographically comparing their sequences of reference tokens: corresponding