fix compile error

This commit is contained in:
zhouyaqiang 2021-09-04 17:32:57 +08:00
parent 95fe15dab4
commit bc519edba2
1 changed files with 3 additions and 7 deletions

View File

@ -63,12 +63,8 @@ struct alignas(sizeof(T) * 2) Complex {
}
#endif
template <typename U = T>
HOST_DEVICE explicit Complex(const std::enable_if_t<std::is_same<U, float>::value, Complex<double>> &other)
: real_(other.real()), imag_(other.imag()) {}
template <typename U = T>
HOST_DEVICE explicit Complex(const std::enable_if_t<std::is_same<U, double>::value, Complex<float>> &other)
: real_(other.real()), imag_(other.imag()) {}
HOST_DEVICE inline explicit Complex(const Complex<U> &other)
: real_(static_cast<T>(other.real())), imag_(static_cast<T>(other.imag())) {}
HOST_DEVICE inline explicit operator bool() const { return static_cast<bool>(real_) || static_cast<bool>(imag_); }
HOST_DEVICE inline explicit operator signed char() const { return static_cast<signed char>(real_); }
@ -87,7 +83,7 @@ struct alignas(sizeof(T) * 2) Complex {
inline explicit operator float16() const { return static_cast<float16>(real_); }
#endif
HOST_DEVICE inline constexpr Complex<T> &operator=(const T &real) {
HOST_DEVICE inline Complex<T> &operator=(const T &real) {
real_ = real;
imag_ = T();
return *this;