Fix MSVC 2015 failures on AppVeyor

- object_capacity() (#5832) overloaded a static with a non-static member
  function template, which MSVC 2015 rejects (C2686); make all three
  overloads non-static.
- The JSON pointer hash constants (#5836) truncate on 32-bit size_t
  (C4309 with /WX); mask them to size_t's range before the cast.
- unit-diagnostics: MSVC 2015 cannot use-declare the base's Container
  typedef (C2886); use alias declarations instead.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-16 08:31:07 +02:00
1 parent ac17aad589
commit e5b8f453e5
4 files changed
+10 -10

No files matched your search

+2 -2
View File
@@ -1225,7 +1225,7 @@ public:
}
template < typename O = object_t, detail::enable_if_t < detail::has_stable_elements<O>::value, int > = 0 >
static constexpr std::size_t object_capacity() noexcept
std::size_t object_capacity() const noexcept
{
return 0;
}
@@ -1237,7 +1237,7 @@ public:
}
template < typename O = object_t, detail::enable_if_t < !detail::has_stable_elements<O>::value && !detail::is_nlohmann_ordered_map<O>::value, int > = 0 >
static constexpr std::size_t object_capacity() noexcept
std::size_t object_capacity() const noexcept
{
return detail::unknown_size();
}