diff --git a/include/fixed_containers/enum_map.hpp b/include/fixed_containers/enum_map.hpp index b69995fe..4150b33d 100644 --- a/include/fixed_containers/enum_map.hpp +++ b/include/fixed_containers/enum_map.hpp @@ -957,7 +957,75 @@ template CheckingType = enum_map_customize::AbortChecking> -using EnumMap = enum_map_detail::specializations::EnumMap; +class EnumMap : public enum_map_detail::specializations::EnumMap +{ + using Self = EnumMap; + using Base = enum_map_detail::specializations::EnumMap; + +public: + using Builder = enum_map_detail::EnumMapBuilder; + + template + static constexpr EnumMapType create_with_keys(const Container& sp, const V& value = V()) + { + return Base::template create_with_keys(sp, value); + } + + template + static constexpr EnumMapType create_with_all_entries( + const CollectionOfPairs& pairs, + const std_transition::source_location& loc = std_transition::source_location::current()) + { + return Base::template create_with_all_entries(pairs, loc); + } + + template + static constexpr EnumMapType create_with_all_entries( + std::initializer_list pairs, + const std_transition::source_location& loc = std_transition::source_location::current()) + { + return Base::template create_with_all_entries(pairs, loc); + } + + template + requires(HasValueType) + static consteval auto create_with_all_entries() + { + return Base::template create_with_all_entries(); + } + template + requires(HasValueType) + static consteval auto create_with_all_entries() + { + return create_with_all_entries(); + } + template + requires(not HasValueType) + static consteval auto create_with_all_entries() + { + return Base::template create_with_all_entries(); + } + template + requires(not HasValueType) + static consteval auto create_with_all_entries() + { + return create_with_all_entries(); + } + + constexpr EnumMap() noexcept + : Base() + { + } + template + constexpr EnumMap(InputIt first, InputIt last) + : Base(first, last) + { + } + constexpr EnumMap(std::initializer_list list) noexcept + : Base(list) + { + } +}; template CheckingType, class Predicate> constexpr typename EnumMap::size_type erase_if(EnumMap& c, diff --git a/include/fixed_containers/fixed_vector.hpp b/include/fixed_containers/fixed_vector.hpp index f45add36..4f6841ef 100644 --- a/include/fixed_containers/fixed_vector.hpp +++ b/include/fixed_containers/fixed_vector.hpp @@ -1026,8 +1026,47 @@ template > -using FixedVector = - fixed_vector_detail::specializations::FixedVector; +class FixedVector + : public fixed_vector_detail::specializations::FixedVector +{ + using Base = fixed_vector_detail::specializations::FixedVector; + +public: + using Builder = + fixed_vector_detail::FixedVectorBuilder>; + + constexpr FixedVector() noexcept + : Base() + { + } + constexpr FixedVector(std::initializer_list list, + const std_transition::source_location& loc = + std_transition::source_location::current()) noexcept + : Base(list, loc) + { + } + constexpr FixedVector(std::size_t count, + const T& value, + const std_transition::source_location& loc = + std_transition::source_location::current()) noexcept + : Base(count, value, loc) + { + } + constexpr explicit FixedVector(std::size_t count, + const std_transition::source_location& loc = + std_transition::source_location::current()) noexcept + : Base(count, loc) + { + } + template + constexpr FixedVector(InputIt first, + InputIt last, + const std_transition::source_location& loc = + std_transition::source_location::current()) noexcept + : Base(first, last, loc) + { + } +}; template constexpr typename FixedVector::size_type is_full( diff --git a/test/enum_map_test.cpp b/test/enum_map_test.cpp index 3f41d0a4..84ee120a 100644 --- a/test/enum_map_test.cpp +++ b/test/enum_map_test.cpp @@ -1378,6 +1378,13 @@ TEST(EnumMap, Ranges) EXPECT_EQ(10, first_entry); } +TEST(EnumMap, ClassTemplateArgumentDeduction) +{ + // Compile-only test + EnumMap a = EnumMap{}; + (void)a; +} + TEST(EnumMap, NonDefaultConstructible) { { @@ -1812,3 +1819,13 @@ INSTANTIATE_TYPED_TEST_SUITE_P(EnumMap, NameProviderForTypeParameterizedTest); } // namespace fixed_containers + +namespace another_namespace_unrelated_to_the_fixed_containers_namespace +{ +TEST(EnumMap, ArgumentDependentLookup) +{ + // Compile-only test + fixed_containers::EnumMap a{}; + erase_if(a, [](auto&&) { return true; }); +} +} // namespace another_namespace_unrelated_to_the_fixed_containers_namespace diff --git a/test/enum_set_test.cpp b/test/enum_set_test.cpp index dfb68e74..8885f18a 100644 --- a/test/enum_set_test.cpp +++ b/test/enum_set_test.cpp @@ -633,6 +633,13 @@ TEST(EnumSet, Ranges) EXPECT_EQ(TestRichEnum1::C_FOUR(), *f.begin()); } +TEST(EnumSet, ClassTemplateArgumentDeduction) +{ + // Compile-only test + EnumSet a = EnumSet{}; + (void)a; +} + TEST(EnumSet, SetIntersection) { constexpr EnumSet s1 = []() @@ -678,3 +685,13 @@ TEST(EnumSet, UsageAsTemplateParameter) } } // namespace fixed_containers + +namespace another_namespace_unrelated_to_the_fixed_containers_namespace +{ +TEST(EnumSet, ArgumentDependentLookup) +{ + // Compile-only test + fixed_containers::EnumSet a{}; + erase_if(a, [](fixed_containers::TestEnum1) { return true; }); +} +} // namespace another_namespace_unrelated_to_the_fixed_containers_namespace diff --git a/test/fixed_map_test.cpp b/test/fixed_map_test.cpp index 1196026b..8b1eacb8 100644 --- a/test/fixed_map_test.cpp +++ b/test/fixed_map_test.cpp @@ -1294,6 +1294,13 @@ TEST(FixedMap, Ranges) EXPECT_EQ(10, first_entry); } +TEST(FixedMap, ClassTemplateArgumentDeduction) +{ + // Compile-only test + FixedMap a = FixedMap{}; + (void)a; +} + TEST(FixedMap, NonDefaultConstructible) { { @@ -1732,3 +1739,14 @@ INSTANTIATE_TYPED_TEST_SUITE_P(FixedMap, NameProviderForTypeParameterizedTest); } // namespace fixed_containers + +namespace another_namespace_unrelated_to_the_fixed_containers_namespace +{ +TEST(FixedMap, ArgumentDependentLookup) +{ + // Compile-only test + fixed_containers::FixedMap a{}; + erase_if(a, [](auto&&) { return true; }); + is_full(a); +} +} // namespace another_namespace_unrelated_to_the_fixed_containers_namespace diff --git a/test/fixed_set_test.cpp b/test/fixed_set_test.cpp index 030671f2..f53f08e4 100644 --- a/test/fixed_set_test.cpp +++ b/test/fixed_set_test.cpp @@ -576,6 +576,13 @@ TEST(FixedSet, Ranges) EXPECT_EQ(4, *f.begin()); } +TEST(FixedSet, ClassTemplateArgumentDeduction) +{ + // Compile-only test + FixedSet a = FixedSet{}; + (void)a; +} + TEST(FixedSet, SetIntersection) { constexpr FixedSet s1 = []() @@ -619,3 +626,14 @@ TEST(FixedSet, UsageAsTemplateParameter) } } // namespace fixed_containers + +namespace another_namespace_unrelated_to_the_fixed_containers_namespace +{ +TEST(FixedSet, ArgumentDependentLookup) +{ + // Compile-only test + fixed_containers::FixedSet a{}; + erase_if(a, [](int) { return true; }); + is_full(a); +} +} // namespace another_namespace_unrelated_to_the_fixed_containers_namespace diff --git a/test/fixed_vector_test.cpp b/test/fixed_vector_test.cpp index d3e23150..e1941c1c 100644 --- a/test/fixed_vector_test.cpp +++ b/test/fixed_vector_test.cpp @@ -1867,6 +1867,13 @@ TEST(FixedVector, NonTriviallyCopyableMoveAssignment) EXPECT_TRUE(are_equal(v2, std::array{1, 2})); } +TEST(FixedVector, ClassTemplateArgumentDeduction) +{ + // Compile-only test + FixedVector a = FixedVector{}; + (void)a; +} + namespace { template /*MY_VEC*/> @@ -2102,3 +2109,15 @@ INSTANTIATE_TYPED_TEST_SUITE_P(FixedVector, NameProviderForTypeParameterizedTest); } // namespace fixed_containers + +namespace another_namespace_unrelated_to_the_fixed_containers_namespace +{ +TEST(FixedVector, ArgumentDependentLookup) +{ + // Compile-only test + fixed_containers::FixedVector a{}; + erase(a, 5); + erase_if(a, [](int) { return true; }); + is_full(a); +} +} // namespace another_namespace_unrelated_to_the_fixed_containers_namespace