diff --git a/headers/flat_hpp/flat_map.hpp b/headers/flat_hpp/flat_map.hpp index 6bf2379..0931e0f 100644 --- a/headers/flat_hpp/flat_map.hpp +++ b/headers/flat_hpp/flat_map.hpp @@ -197,19 +197,27 @@ namespace flat_hpp const_reverse_iterator rend() const noexcept { return data_.rend(); } const_reverse_iterator crend() const noexcept { return data_.crend(); } - bool empty() const noexcept { + bool empty() const + noexcept(noexcept(std::declval().empty())) + { return data_.empty(); } - size_type size() const noexcept { + size_type size() const + noexcept(noexcept(std::declval().size())) + { return data_.size(); } - size_type max_size() const noexcept { + size_type max_size() const + noexcept(noexcept(std::declval().max_size())) + { return data_.max_size(); } - size_type capacity() const noexcept { + size_type capacity() const + noexcept(noexcept(std::declval().capacity())) + { return data_.capacity(); } @@ -300,7 +308,9 @@ namespace flat_hpp return insert(hint, value_type(std::forward(args)...)); } - void clear() noexcept { + void clear() + noexcept(noexcept(std::declval().clear())) + { data_.clear(); } diff --git a/headers/flat_hpp/flat_multimap.hpp b/headers/flat_hpp/flat_multimap.hpp index b5131d3..a2342e7 100644 --- a/headers/flat_hpp/flat_multimap.hpp +++ b/headers/flat_hpp/flat_multimap.hpp @@ -197,19 +197,27 @@ namespace flat_hpp const_reverse_iterator rend() const noexcept { return data_.rend(); } const_reverse_iterator crend() const noexcept { return data_.crend(); } - bool empty() const noexcept { + bool empty() const + noexcept(noexcept(std::declval().empty())) + { return data_.empty(); } - size_type size() const noexcept { + size_type size() const + noexcept(noexcept(std::declval().size())) + { return data_.size(); } - size_type max_size() const noexcept { + size_type max_size() const + noexcept(noexcept(std::declval().max_size())) + { return data_.max_size(); } - size_type capacity() const noexcept { + size_type capacity() const + noexcept(noexcept(std::declval().capacity())) + { return data_.capacity(); } @@ -296,7 +304,9 @@ namespace flat_hpp return insert(hint, value_type(std::forward(args)...)); } - void clear() noexcept { + void clear() + noexcept(noexcept(std::declval().clear())) + { data_.clear(); } diff --git a/headers/flat_hpp/flat_multiset.hpp b/headers/flat_hpp/flat_multiset.hpp index 128906f..15b2623 100644 --- a/headers/flat_hpp/flat_multiset.hpp +++ b/headers/flat_hpp/flat_multiset.hpp @@ -142,19 +142,27 @@ namespace flat_hpp const_reverse_iterator rend() const noexcept { return data_.rend(); } const_reverse_iterator crend() const noexcept { return data_.crend(); } - bool empty() const noexcept { + bool empty() const + noexcept(noexcept(std::declval().empty())) + { return data_.empty(); } - size_type size() const noexcept { + size_type size() const + noexcept(noexcept(std::declval().size())) + { return data_.size(); } - size_type max_size() const noexcept { + size_type max_size() const + noexcept(noexcept(std::declval().max_size())) + { return data_.max_size(); } - size_type capacity() const noexcept { + size_type capacity() const + noexcept(noexcept(std::declval().capacity())) + { return data_.capacity(); } @@ -211,7 +219,9 @@ namespace flat_hpp return insert(hint, value_type(std::forward(args)...)); } - void clear() noexcept { + void clear() + noexcept(noexcept(std::declval().clear())) + { data_.clear(); } diff --git a/headers/flat_hpp/flat_set.hpp b/headers/flat_hpp/flat_set.hpp index 366e810..f2ee662 100644 --- a/headers/flat_hpp/flat_set.hpp +++ b/headers/flat_hpp/flat_set.hpp @@ -142,19 +142,27 @@ namespace flat_hpp const_reverse_iterator rend() const noexcept { return data_.rend(); } const_reverse_iterator crend() const noexcept { return data_.crend(); } - bool empty() const noexcept { + bool empty() const + noexcept(noexcept(std::declval().empty())) + { return data_.empty(); } - size_type size() const noexcept { + size_type size() const + noexcept(noexcept(std::declval().size())) + { return data_.size(); } - size_type max_size() const noexcept { + size_type max_size() const + noexcept(noexcept(std::declval().max_size())) + { return data_.max_size(); } - size_type capacity() const noexcept { + size_type capacity() const + noexcept(noexcept(std::declval().capacity())) + { return data_.capacity(); } @@ -215,7 +223,9 @@ namespace flat_hpp return insert(hint, value_type(std::forward(args)...)); } - void clear() noexcept { + void clear() + noexcept(noexcept(std::declval().clear())) + { data_.clear(); } diff --git a/untests/flat_map_tests.cpp b/untests/flat_map_tests.cpp index 6d7a79e..5b2e958 100644 --- a/untests/flat_map_tests.cpp +++ b/untests/flat_map_tests.cpp @@ -74,6 +74,13 @@ TEST_CASE("flat_map") { STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(!std::is_nothrow_swappable_v); + + STATIC_REQUIRE(noexcept(std::declval().empty())); + STATIC_REQUIRE(noexcept(std::declval().size())); + STATIC_REQUIRE(noexcept(std::declval().max_size())); + STATIC_REQUIRE(noexcept(std::declval().capacity())); + + STATIC_REQUIRE(noexcept(std::declval().clear())); } SECTION("types") { using map_t = flat_map; diff --git a/untests/flat_multimap_tests.cpp b/untests/flat_multimap_tests.cpp index bc550f1..a6cd36b 100644 --- a/untests/flat_multimap_tests.cpp +++ b/untests/flat_multimap_tests.cpp @@ -74,6 +74,13 @@ TEST_CASE("flat_multimap") { STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(!std::is_nothrow_swappable_v); + + STATIC_REQUIRE(noexcept(std::declval().empty())); + STATIC_REQUIRE(noexcept(std::declval().size())); + STATIC_REQUIRE(noexcept(std::declval().max_size())); + STATIC_REQUIRE(noexcept(std::declval().capacity())); + + STATIC_REQUIRE(noexcept(std::declval().clear())); } SECTION("types") { using map_t = flat_multimap; diff --git a/untests/flat_multiset_tests.cpp b/untests/flat_multiset_tests.cpp index 014cb1a..748fe21 100644 --- a/untests/flat_multiset_tests.cpp +++ b/untests/flat_multiset_tests.cpp @@ -74,6 +74,13 @@ TEST_CASE("flat_multiset") { STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(!std::is_nothrow_swappable_v); + + STATIC_REQUIRE(noexcept(std::declval().empty())); + STATIC_REQUIRE(noexcept(std::declval().size())); + STATIC_REQUIRE(noexcept(std::declval().max_size())); + STATIC_REQUIRE(noexcept(std::declval().capacity())); + + STATIC_REQUIRE(noexcept(std::declval().clear())); } SECTION("types") { using set_t = flat_multiset; diff --git a/untests/flat_set_tests.cpp b/untests/flat_set_tests.cpp index 40a04c4..f49cc14 100644 --- a/untests/flat_set_tests.cpp +++ b/untests/flat_set_tests.cpp @@ -74,6 +74,13 @@ TEST_CASE("flat_set") { STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(std::is_nothrow_swappable_v); STATIC_REQUIRE(!std::is_nothrow_swappable_v); + + STATIC_REQUIRE(noexcept(std::declval().empty())); + STATIC_REQUIRE(noexcept(std::declval().size())); + STATIC_REQUIRE(noexcept(std::declval().max_size())); + STATIC_REQUIRE(noexcept(std::declval().capacity())); + + STATIC_REQUIRE(noexcept(std::declval().clear())); } SECTION("types") { using set_t = flat_set;