[libcxx-commits] [libcxx] [libc++] <experimental/simd> Add unary operators for class simd (PR #104764)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 20 23:47:20 PDT 2024


================
@@ -26,15 +27,29 @@
 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
 inline namespace parallelism_v2 {
 
+template <class _Simd, class _Impl, bool>
+class __simd_int_operators {};
+
+template <class _Simd, class _Impl>
+class __simd_int_operators<_Simd, _Impl, true> {
+public:
+  // unary operators for integral _Tp
+  _LIBCPP_HIDE_FROM_ABI _Simd operator~() const noexcept {
----------------
joy2myself wrote:

Thanks for the suggestion! I opted for `__simd_int_operators` because I need to add more integer-only operators (like bitwise, modulus, shifts and their compound assignments) later and thought centralizing them here would keep things consistent. Do you think it’s better to stick with this, or switch to using `enable_if_t` individually for each operator?

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


More information about the libcxx-commits mailing list