From dae54122684bbe256117b82992e95e7840720b75 Mon Sep 17 00:00:00 2001 From: Florian Albrechtskirchinger Date: Sun, 7 Aug 2022 13:55:09 +0200 Subject: [PATCH] Properly constrain non-string json_pointer overloads (#3681) Thanks, @alex-700, for reminding me. --- include/nlohmann/json.hpp | 8 ++++---- single_include/nlohmann/json.hpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 5fda88f26..5fdb8c900 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -2736,9 +2736,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return ptr.contains(this); } - template + template::value, int> = 0> JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer) // NOLINT(readability/alt_tokens) - bool contains(const typename ::nlohmann::json_pointer ptr) const + bool contains(const typename ::nlohmann::json_pointer& ptr) const { return ptr.contains(this); } @@ -4617,7 +4617,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return ptr.get_checked(this); } - template + template::value, int> = 0> JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer) // NOLINT(readability/alt_tokens) reference at(const ::nlohmann::json_pointer& ptr) { @@ -4631,7 +4631,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return ptr.get_checked(this); } - template + template::value, int> = 0> JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer) // NOLINT(readability/alt_tokens) const_reference at(const ::nlohmann::json_pointer& ptr) const { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 7d8d91e2e..989c799ee 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -21868,9 +21868,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return ptr.contains(this); } - template + template::value, int> = 0> JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer) // NOLINT(readability/alt_tokens) - bool contains(const typename ::nlohmann::json_pointer ptr) const + bool contains(const typename ::nlohmann::json_pointer& ptr) const { return ptr.contains(this); } @@ -23749,7 +23749,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return ptr.get_checked(this); } - template + template::value, int> = 0> JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer) // NOLINT(readability/alt_tokens) reference at(const ::nlohmann::json_pointer& ptr) { @@ -23763,7 +23763,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return ptr.get_checked(this); } - template + template::value, int> = 0> JSON_HEDLEY_DEPRECATED_FOR(3.11.0, basic_json::json_pointer or nlohmann::json_pointer) // NOLINT(readability/alt_tokens) const_reference at(const ::nlohmann::json_pointer& ptr) const {