Posts

Showing posts with the label language-lawyer

Ambiguous resolution with template conversion operator

Ambiguous resolution with template conversion operator I had to do a similar code: #include <type_traits> template<typename S> struct probe { template<typename T, typename U = S, std::enable_if_t< std::is_same<T&, U>::value && !std::is_const<T>::value, int> = 0> operator T& () const; template<typename T, typename U = S&&, std::enable_if_t< std::is_same<T&&, U>::value && !std::is_const<T>::value, int> = 0> operator T&& (); template<typename T, typename U = S, std::enable_if_t< std::is_same<T const&, U>::value, int> = 0> operator T const& () const; template<typename T, typename U = S&&, std::enable_if_t< std::is_same<T const&&, U>::value, int> = 0> operator T const&& () const; }; struct some_type {}; struct other_type {}; auto test_call...