From 2474843c55461650e6d1a299ecfffc3d6b40cbd8 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 9 Oct 2026 23:51:25 +0200 Subject: [PATCH] Make json_view.hpp pass include-what-you-use Mark the includes that are needed by design (json.hpp, the macro unscope, for the tuple_size specialization), take size_t from , and drop the forward declaration of basic_json_document that the friend declaration makes redundant. Signed-off-by: Niels Lohmann --- include/nlohmann/json_view.hpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/nlohmann/json_view.hpp b/include/nlohmann/json_view.hpp index 256466fa0..d1f83af41 100644 --- a/include/nlohmann/json_view.hpp +++ b/include/nlohmann/json_view.hpp @@ -24,19 +24,18 @@ #ifndef INCLUDE_NLOHMANN_JSON_VIEW_HPP_ #define INCLUDE_NLOHMANN_JSON_VIEW_HPP_ -#include // size_t -#include // memcpy, strlen +#include // memcpy, size_t, strlen #include // distance, input_iterator_tag, iterator_traits #include // map #include // unique_ptr #include // string -#include // tuple_element, tuple_size +#include // tuple_element, tuple_size // IWYU pragma: keep #include // decay, enable_if, integral_constant, is_arithmetic, is_base_of, is_integral, is_same, remove_cv, remove_extent #include // unordered_map #include // forward, move #include // vector -#include +#include // IWYU pragma: export // the view builds on internals of the library: both must be the same version #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 12 || NLOHMANN_JSON_VERSION_PATCH != 0 @@ -58,9 +57,6 @@ NLOHMANN_JSON_NAMESPACE_BEGIN -template -class basic_json_document; - /*! @brief read-only handle to one value of a basic_json_document @@ -1074,6 +1070,6 @@ class tuple_element> // NOLINT(cert } // namespace std -#include +#include // IWYU pragma: keep #endif // INCLUDE_NLOHMANN_JSON_VIEW_HPP_