Skip to content

Commit 0d0128e

Browse files
authored
Fix sfinae for cmplx_t convertions (#76)
1 parent 7c360c6 commit 0d0128e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.10)
2-
project(dsplib LANGUAGES CXX VERSION 0.54.7)
2+
project(dsplib LANGUAGES CXX VERSION 0.54.8)
33

44
set(CMAKE_CXX_STANDARD 17)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)

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)