Skip to content

Commit

Permalink
Avoid error in presence of Windows min/max macros
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MiKom committed Jan 8, 2024
1 parent 86d6bd5 commit dc55043
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/kdbindings/genindex_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>::max()) {
// (parentheses added to avoid Windows min/max macros)
if (m_entries.size() + 1 >= (std::numeric_limits<uint32_t>::max)()) {
throw std::length_error(std::string("Maximum number of values inside GenerationalIndexArray reached: ") + std::to_string(m_entries.size()));
}

Expand Down

0 comments on commit dc55043

Please sign in to comment.