[libcxx-commits] [libcxx] [libc++] <experimental/simd> Add assignment operator of simd reference (PR #70020)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 25 02:09:14 PDT 2023
================
@@ -0,0 +1,79 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14
+
+// <experimental/simd>
+//
+// [simd.reference]
+// template<class U> reference=(U&& x) && noexcept;
+
+#include "../test_utils.h"
+#include <experimental/simd>
+
+namespace ex = std::experimental::parallelism_v2;
+
+template <class T, class SimdAbi>
+struct CheckSimdReferenceAssignmentHelper {
+ template <class U>
+ void operator()() const {
+ if constexpr (std::is_assignable_v<T&, U&&>) {
+ ex::simd<T, SimdAbi> origin_simd([](T i) { return i; });
+ for (size_t i = 0; i < origin_simd.size(); ++i) {
+ origin_simd[i] = static_cast<U>(i + 1);
+ assert(origin_simd[i] == static_cast<T>(std::forward<U>(i + 1)));
----------------
philnik777 wrote:
Please add a check to make sure `operator=` is `noexpect`.
https://github.com/llvm/llvm-project/pull/70020
More information about the libcxx-commits
mailing list