summaryrefslogtreecommitdiff
path: root/include/fud_vector.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/fud_vector.hpp')
-rw-r--r--include/fud_vector.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/fud_vector.hpp b/include/fud_vector.hpp
index 53b2625..a2a0984 100644
--- a/include/fud_vector.hpp
+++ b/include/fud_vector.hpp
@@ -647,8 +647,9 @@ class Vector {
{
// See https://github.com/facebook/folly/blob/main/folly/docs/FBVector.md
size_t additional = m_capacity < 2 ? 1 : m_capacity / 2;
- if (SIZE_MAX - additional * ElementSize < m_capacity * ElementSize) {
- additional = SIZE_MAX - m_capacity * ElementSize / 2;
+ constexpr auto maxSize = std::numeric_limits<size_t>::max();
+ if (maxSize - additional * ElementSize < m_capacity * ElementSize) {
+ additional = maxSize - m_capacity * ElementSize / 2;
}
while (additional > 0) {
auto reserveStatus = reserve(additional + m_capacity);