Skip to content

Commit c57f5e2

Browse files
committed
Fix sfinae for cmplx_t convertions
1 parent 7c360c6 commit c57f5e2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/dsplib/types.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,28 +98,28 @@ using enable_convertible_t = typename enable_convertible<T, T2>::type;
9898
//basic complex type
9999
struct cmplx_t
100100
{
101-
constexpr cmplx_t(real_t re_ = 0, real_t im_ = 0)
102-
: re{re_}
103-
, im{im_} {
101+
constexpr cmplx_t(real_t vre = 0, real_t vim = 0)
102+
: re{vre}
103+
, im{vim} {
104104
}
105105

106106
constexpr cmplx_t(const cmplx_t&) = default;
107107

108108
//scalar -> cmplx_t
109-
template<typename T, class S_ = typename std::is_arithmetic<T>::type>
109+
template<typename T, std::enable_if_t<std::is_arithmetic_v<std::remove_reference_t<T>>>* = nullptr>
110110
constexpr cmplx_t(const T& v)
111111
: re{static_cast<real_t>(v)} {
112112
}
113113

114114
//std::complex -> cmplx_t
115-
template<typename T>
115+
template<typename T, std::enable_if_t<std::is_arithmetic_v<std::remove_reference_t<T>>>* = nullptr>
116116
constexpr cmplx_t(const std::complex<T>& v)
117117
: re{static_cast<real_t>(v.real())}
118118
, im{static_cast<real_t>(v.imag())} {
119119
}
120120

121121
//cmplx_t -> std::complex
122-
template<typename T>
122+
template<typename T, std::enable_if_t<std::is_arithmetic_v<std::remove_reference_t<T>>>* = nullptr>
123123
operator std::complex<T>() const {
124124
return std::complex<T>(static_cast<T>(re), static_cast<T>(im));
125125
}

0 commit comments

Comments
 (0)