diff --git a/c++/nda/mapped_functions.hpp b/c++/nda/mapped_functions.hpp index 4661b46d..459cfa42 100644 --- a/c++/nda/mapped_functions.hpp +++ b/c++/nda/mapped_functions.hpp @@ -28,7 +28,6 @@ #include #include -#include #include namespace nda { @@ -41,26 +40,12 @@ namespace nda { namespace detail { // Get the real part of a scalar. - template - auto real(T t) - requires(nda::is_scalar_v) - { - if constexpr (is_complex_v) { - return std::real(t); + template + auto real(S x) { + if constexpr (is_complex_v) { + return std::real(x); } else { - return t; - } - } - - // Get the complex conjugate of a scalar. - template - auto conj(T t) - requires(nda::is_scalar_v) - { - if constexpr (is_complex_v) { - return std::conj(t); - } else { - return t; + return x; } } @@ -75,7 +60,14 @@ namespace nda { // Functor for nda::detail::conj. struct conj_f { - auto operator()(auto const &x) const { return conj(x); }; + template + auto operator()(S x) const { + if constexpr (is_complex_v) { + return std::conj(x); + } else { + return x; + } + } }; } // namespace detail