Kokkos: std::is_convertible<Kokkos::complex<T1>, T2> is not defined.

Created on 4 Jun 2018  路  4Comments  路  Source: kokkos/kokkos

In STD, is_convertible is not defined with Kokkos::complex nor std::complex. In practice, these should behave like

namespace std {
  template<typename T1, typename T2>
  struct is_convertible<T1,Kokkos::complex<T2> >, { static constexpr value = std::is_convertible<T1,T2>::value; };
  struct is_convertible<T1,std::complex<T2> >, { static constexpr value = std::is_convertible<T1,T2>::value; };

}

Can we put this in the Kokkos_Complex.hpp ?

question

All 4 comments

https://en.cppreference.com/w/cpp/language/extending_std

None of the templates defined in <type_traits> may be specialized for a user-defined type, except for std::common_type. This includes the type traits and the class template std::integral_constant.

Also, std::is_convertible implementations should not need an implementation for custom types. They use SFINAE to check whether an implicit assignment actually compiles. Thus, if std::is_convertible doesn't work, that suggests that implicit assignment doesn't compile.

I agree with @mhoemmen , defining our own specialization is not the right answer. If you're getting a negative result or a compile error, we should investigate why that is happening.

Agreed.

Was this page helpful?
0 / 5 - 0 ratings