[libc-commits] [libc] [libc][complex] Implement different flavors of the `conj` function (PR #118671)

via libc-commits libc-commits at lists.llvm.org
Sun Dec 8 11:45:31 PST 2024


================
@@ -16,5 +16,12 @@ template <typename T> struct Complex {
   T real;
   T imag;
 };
+
+template <typename T, typename U> T conjugate(T c) {
----------------
lntue wrote:

Probably we should add some type trait utilities to get corresponding complex and real types, something like (I'm trying to avoid the macro `complex`):
```
template <typename T> struct make_complex;
template <> struct make_complex<float> { using type = float; };
...
template<typename T> using make_complex_t<T> = typename make_complex<T>::type;
...
```
and define `make_real` similarly.  WDYT?

https://github.com/llvm/llvm-project/pull/118671


More information about the libc-commits mailing list