[libcxx-commits] [libcxx] [RFC][libc++] Fixes valarray proxy type operations. (PR #76528)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 9 10:04:19 PST 2024
================
@@ -819,6 +819,19 @@ public:
_LIBCPP_HIDE_FROM_ABI valarray& operator<<=(const value_type& __x);
_LIBCPP_HIDE_FROM_ABI valarray& operator>>=(const value_type& __x);
+ // The valarray overloads are needed for the types with an implicit
+ // conversion to valarray. For example slice_array.
+ _LIBCPP_HIDE_FROM_ABI valarray& operator*=(const valarray& __v) { return operator*= <valarray>(__v); }
----------------
ldionne wrote:
Instead, I think we should make things like `gslice_array` & friends be `__val_expr`s and give them the necessary indexing operators (via a private name). That would allow for a much more efficient implementation of e.g. `valarray::operator*=` than if we need to create a temporary `valarray` first.
https://github.com/llvm/llvm-project/pull/76528
More information about the libcxx-commits
mailing list