diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index 9091fbe37..15aa88832 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -13,6 +13,7 @@ #include // tuple #include // false_type, is_constructible, is_integral, is_same, true_type #include // declval +#include // vector #if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L #include // byte #endif diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 674794bc7..e2afdda11 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3593,6 +3593,7 @@ NLOHMANN_JSON_NAMESPACE_END #include // tuple #include // false_type, is_constructible, is_integral, is_same, true_type #include // declval +#include // vector #if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L #include // byte #endif diff --git a/tests/src/unit-regression2.cpp b/tests/src/unit-regression2.cpp index 0035ecfb4..91dc10dbf 100644 --- a/tests/src/unit-regression2.cpp +++ b/tests/src/unit-regression2.cpp @@ -1140,7 +1140,7 @@ TEST_CASE("regression tests 2") { // Test that assigning a custom BinaryType directly creates a binary value, not an array const std::vector original{std::byte{1}, std::byte{2}, std::byte{3}}; - json_4804 j = original; + const json_4804 j = original; CHECK(j.is_binary()); CHECK(!j.is_array()); @@ -1149,7 +1149,7 @@ TEST_CASE("regression tests 2") CHECK(extracted == original); // Test that the default json alias behavior is unchanged: std::vector -> array - json default_json = std::vector {1, 2, 3}; + const json default_json = std::vector {1, 2, 3}; CHECK(default_json.is_array()); CHECK(!default_json.is_binary()); } @@ -1158,7 +1158,7 @@ TEST_CASE("regression tests 2") { // Test that extracting a custom BinaryType from a parsed JSON array still works // (not just from a binary-typed node) - auto j = json_4804::parse("[1,2,3]"); + const auto j = json_4804::parse("[1,2,3]"); CHECK(j.is_array()); CHECK(!j.is_binary());