@@ -2012,7 +2012,8 @@ constexpr auto is( X const& x ) -> auto
2012
2012
}
2013
2013
2014
2014
2015
- inline constexpr auto is ( specialization_of_template<std::variant> auto const & x, auto && value ) -> bool
2015
+ template <specialization_of_template<std::variant> X>
2016
+ inline constexpr auto is ( X const & x, auto && value ) -> bool
2016
2017
{
2017
2018
return type_find_if (x, [&]<typename It>(It const &) -> bool {
2018
2019
if (x.index () == It::index ) {
@@ -2026,16 +2027,16 @@ inline constexpr auto is( specialization_of_template<std::variant> auto const& x
2026
2027
}) != std::variant_npos;
2027
2028
}
2028
2029
2029
- template < typename C >
2030
- auto as (specialization_of_template<std::variant> auto && x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto )
2030
+ template < typename C, specialization_of_template<std::variant> X >
2031
+ auto as ( X && x CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAULT_AS) -> decltype(auto )
2031
2032
{
2032
- constness_like_t <C, decltype (x) >* ptr = nullptr ;
2033
+ constness_like_t <C, X >* ptr = nullptr ;
2033
2034
type_find_if (CPP2_FORWARD (x), [&]<typename It>(It const &) -> bool {
2034
2035
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 ; } };
2035
2036
return false ;
2036
2037
});
2037
2038
if (!ptr) { Throw ( std::bad_variant_access (), " 'as' cast failed for 'variant'" ); }
2038
- return cpp2::forward_like<decltype (x) >(*ptr);
2039
+ return cpp2::forward_like<X >(*ptr);
2039
2040
}
2040
2041
2041
2042
// -------------------------------------------------------------------------------------------------------------
0 commit comments