From 3d28dd096e4b02149601dc371a2b1c14079625b2 Mon Sep 17 00:00:00 2001 From: Yuriy Chernyshov Date: Fri, 5 Aug 2022 16:22:09 +0300 Subject: [PATCH] Fix -Wignored-reference-qualifiers In certain STLs, `std::vector::reference` is just `bool&`. Prepending `const` causes the following warning: ``` include/nlohmann/detail/conversions/to_json.hpp:271:42: error: 'const' qualifier on reference type 'std::vector::reference' (aka 'bool &') has no effect [-Werror,-Wignored-reference-qualifiers] ``` This PR fixes the problem. --- include/nlohmann/detail/conversions/to_json.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/conversions/to_json.hpp b/include/nlohmann/detail/conversions/to_json.hpp index ba24c118d..52ddaddef 100644 --- a/include/nlohmann/detail/conversions/to_json.hpp +++ b/include/nlohmann/detail/conversions/to_json.hpp @@ -268,8 +268,8 @@ inline void to_json(BasicJsonType& j, T b) noexcept } template::reference&, typename BasicJsonType::boolean_t>::value, int> = 0> -inline void to_json(BasicJsonType& j, const std::vector::reference& b) noexcept + enable_if_t::const_reference&, typename BasicJsonType::boolean_t>::value, int> = 0> +inline void to_json(BasicJsonType& j, std::vector::const_reference& b) noexcept { external_constructor::construct(j, static_cast(b)); }