From ac5a99da31109e6410264524cb842722bedf13d3 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Thu, 15 Jun 2023 09:17:25 -0700 Subject: [PATCH] Add max_size() impl --- include/boost/unordered/concurrent_flat_map.hpp | 1 + test/cfoa/fwd_tests.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/boost/unordered/concurrent_flat_map.hpp b/include/boost/unordered/concurrent_flat_map.hpp index aa699844..a47eee81 100644 --- a/include/boost/unordered/concurrent_flat_map.hpp +++ b/include/boost/unordered/concurrent_flat_map.hpp @@ -246,6 +246,7 @@ namespace boost { /// size_type size() const noexcept { return table_.size(); } + size_type max_size() const noexcept { return table_.max_size(); } BOOST_ATTRIBUTE_NODISCARD bool empty() const noexcept { diff --git a/test/cfoa/fwd_tests.cpp b/test/cfoa/fwd_tests.cpp index 80cd4a0c..dced611e 100644 --- a/test/cfoa/fwd_tests.cpp +++ b/test/cfoa/fwd_tests.cpp @@ -5,6 +5,7 @@ #include "helpers.hpp" #include #include +#include test::seed_t initialize_seed{32304628}; @@ -58,4 +59,12 @@ UNORDERED_AUTO_TEST (fwd_unequal_call) { BOOST_TEST_NOT(unequal_call(x1, x2)); } +// this isn't the best place for this test but it's better than introducing a +// new file +UNORDERED_AUTO_TEST (max_size) { + map_type x1; + BOOST_TEST_EQ( + x1.max_size(), std::numeric_limits::max()); +} + RUN_TESTS()