Fix -Wignored-reference-qualifiers

In certain STLs, `std::vector<bool>::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<bool>::reference' (aka 'bool &') has no effect [-Werror,-Wignored-reference-qualifiers]
```

This PR fixes the problem.
This commit is contained in:
Yuriy Chernyshov 2022-08-05 16:22:09 +03:00 committed by GitHub
parent 9e1a7c85e3
commit 3d28dd096e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -268,8 +268,8 @@ inline void to_json(BasicJsonType& j, T b) noexcept
}
template<typename BasicJsonType,
enable_if_t<std::is_convertible<const std::vector<bool>::reference&, typename BasicJsonType::boolean_t>::value, int> = 0>
inline void to_json(BasicJsonType& j, const std::vector<bool>::reference& b) noexcept
enable_if_t<std::is_convertible<std::vector<bool>::const_reference&, typename BasicJsonType::boolean_t>::value, int> = 0>
inline void to_json(BasicJsonType& j, std::vector<bool>::const_reference& b) noexcept
{
external_constructor<value_t::boolean>::construct(j, static_cast<typename BasicJsonType::boolean_t>(b));
}