diff --git a/CHANGELOG.md b/CHANGELOG.md index e36b85bf29..9b50f2e640 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fix warning in documentation generation caused by `diff` docstring [gh-1855](https://github.com/IntelPython/dpctl/pull/1855) * Fix additional warnings when generating docs [gh-1861](https://github.com/IntelPython/dpctl/pull/1861) * Add missing include of SYCL header to "math_utils.hpp" [gh-1899](https://github.com/IntelPython/dpctl/pull/1899) +* Add support of CV-qualifiers in `is_complex` helper [gh-1900](https://github.com/IntelPython/dpctl/pull/1900) ## [0.18.1] - Oct. 11, 2024 diff --git a/dpctl/tensor/libtensor/include/utils/type_utils.hpp b/dpctl/tensor/libtensor/include/utils/type_utils.hpp index 8207f7a68d..2ab5392ebd 100644 --- a/dpctl/tensor/libtensor/include/utils/type_utils.hpp +++ b/dpctl/tensor/libtensor/include/utils/type_utils.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace dpctl @@ -35,13 +36,22 @@ namespace tensor namespace type_utils { -template struct is_complex : std::false_type +template +struct is_complex : public std::false_type { }; -template struct is_complex> : std::true_type + +template +struct is_complex< + T, + std::enable_if_t, std::complex> || + std::is_same_v, std::complex>>> + : public std::true_type { }; +template constexpr bool is_complex_v = is_complex::value; + template dstTy convert_impl(const srcTy &v) { if constexpr (std::is_same::value) {