From 2692892e26668eeb04837f7d945f7a5471729b66 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 18 Oct 2026 13:31:30 +0200 Subject: [PATCH] Allow the string literal parameter of the view serializer's put() for clang-tidy The overload takes the literal by array reference so that its length is a template parameter, like scan_literal() and the C array overloads of to_json() and from_json(). Signed-off-by: Niels Lohmann --- include/nlohmann/detail/view/serializer.hpp | 2 +- single_include/nlohmann/json_view.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/view/serializer.hpp b/include/nlohmann/detail/view/serializer.hpp index 4ec902421..d450ecfd3 100644 --- a/include/nlohmann/detail/view/serializer.hpp +++ b/include/nlohmann/detail/view/serializer.hpp @@ -71,7 +71,7 @@ class output_buffer /// a string literal, without its terminating NUL template - NLOHMANN_VIEW_ALWAYS_INLINE void put(const char (&s)[N]) + NLOHMANN_VIEW_ALWAYS_INLINE void put(const char (&s)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) { put(s, N - 1); } diff --git a/single_include/nlohmann/json_view.hpp b/single_include/nlohmann/json_view.hpp index 5812edeed..bd765fc2e 100644 --- a/single_include/nlohmann/json_view.hpp +++ b/single_include/nlohmann/json_view.hpp @@ -3409,7 +3409,7 @@ class output_buffer /// a string literal, without its terminating NUL template - NLOHMANN_VIEW_ALWAYS_INLINE void put(const char (&s)[N]) + NLOHMANN_VIEW_ALWAYS_INLINE void put(const char (&s)[N]) // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays) { put(s, N - 1); }