From 691c74ba4dd0b7509b7e8798be578ed1f3f9c98d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Kosobucki?= Date: Mon, 8 Jan 2024 13:52:51 +0100 Subject: [PATCH] Avoid error in presence of Windows min/max macros In theory we could relegate the responsibility of defining NOMINMAX to the users of KDBindings but as it's such a tiny change I rather carry it here and avoid the problem altogheter. --- src/kdbindings/genindex_array.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kdbindings/genindex_array.h b/src/kdbindings/genindex_array.h index 4da17d8..27a54dc 100644 --- a/src/kdbindings/genindex_array.h +++ b/src/kdbindings/genindex_array.h @@ -66,7 +66,8 @@ class GenerationalIndexAllocator return { index, m_entries[index].generation }; } else { // check that we are still within the bounds of uint32_t - if (m_entries.size() + 1 >= std::numeric_limits::max()) { + // (parentheses added to avoid Windows min/max macros) + if (m_entries.size() + 1 >= (std::numeric_limits::max)()) { throw std::length_error(std::string("Maximum number of values inside GenerationalIndexArray reached: ") + std::to_string(m_entries.size())); }