[libc-commits] [libc] [libc][complex] Implement different flavors of the `conj` function (PR #118671)
via libc-commits
libc-commits at lists.llvm.org
Mon Dec 9 10:13:33 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:
So the complexity of 2 template parameters will expanded down the line when more functions are implemented, and it will hinder template argument deduction if both types are not presented in the arguments. An apt example would be imagine every template function implementation for `float` will also have to pass the corresponding `FPBits` type to the template parameter, instead of using `FPBits<float>` inside the implementation. If you don't want to put those interchanging template utilities in `complex_type.h`, feel free to add another header in `__support/CPP/type_traits/` and include that here.
https://github.com/llvm/llvm-project/pull/118671
More information about the libc-commits
mailing list