@@ -1764,9 +1764,7 @@ constexpr auto is( X const& x ) -> auto {
17641764 }
17651765 }
17661766 return type_find_if (x, [&]<typename It>(It const &) -> bool {
1767- if constexpr (It::index < 20 ) {
1768- if (x.index () == It::index) { return std::is_same_v<C, std::variant_alternative_t <It::index, X>>;}
1769- }
1767+ if (x.index () == It::index) { return std::is_same_v<C, std::variant_alternative_t <It::index, X>>;}
17701768 return false ;
17711769 }) != std::variant_npos;
17721770 }
@@ -1822,13 +1820,11 @@ inline constexpr auto is( auto const& x, auto&& value ) -> bool
18221820 }
18231821 else if constexpr (specialization_of_template<decltype (x), std::variant> ) {
18241822 return type_find_if (x, [&]<typename It>(It const &) -> bool {
1825- if constexpr (It::index < 20 ) { // TODO: remove after refactor
1826- if (x.index () == It::index) {
1827- if constexpr (valid_predicate<decltype (value), decltype (std::get<It::index>(x))>) {
1828- return value (std::get<It::index>(x));
1829- } else if constexpr ( requires { bool {std::get<It::index>(x) == value}; } ) {
1830- return std::get<It::index>(x) == value;
1831- }
1823+ if (x.index () == It::index) {
1824+ if constexpr (valid_predicate<decltype (value), decltype (std::get<It::index>(x))>) {
1825+ return value (std::get<It::index>(x));
1826+ } else if constexpr ( requires { bool {std::get<It::index>(x) == value}; } ) {
1827+ return std::get<It::index>(x) == value;
18321828 }
18331829 }
18341830 return false ;
@@ -2014,9 +2010,7 @@ auto as(auto&& x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto)
20142010 else if constexpr (specialization_of_template<decltype (x), std::variant>) {
20152011 constness_like_t <C, decltype (x)>* ptr = nullptr ;
20162012 type_find_if (CPP2_FORWARD (x), [&]<typename It>(It const &) -> bool {
2017- if constexpr (It::index < 20 ) {
2018- if constexpr (std::is_same_v< typename It::type, C >) { if (CPP2_FORWARD (x).index () == It::index) { ptr = &std::get<It::index>(x); return true ; } };
2019- }
2013+ if constexpr (std::is_same_v< typename It::type, C >) { if (CPP2_FORWARD (x).index () == It::index) { ptr = &std::get<It::index>(x); return true ; } };
20202014 return false ;
20212015 });
20222016 if (!ptr) { Throw ( std::bad_variant_access (), " 'as' cast failed for 'variant'" ); }
0 commit comments