28 #ifndef VC_COMMON_WRITEMASKEDVECTOR_H_
29 #define VC_COMMON_WRITEMASKEDVECTOR_H_
34 namespace Vc_VERSIONED_NAMESPACE
39 template <
typename V,
typename M =
typename V::Mask>
class WriteMaskedVector
43 "incorrect use of Vc::Common::WriteMaskedVector<V, M>. V and M must have the same «Size».");
47 static constexpr
size_t Size = V::Size;
49 Vc_FREE_STORE_OPERATORS_ALIGNED(
alignof(Mask));
52 Vc_INTRINSIC WriteMaskedVector(V &v,
const Mask &k) : mask(k), vec(v)
57 Vc_INTRINSIC V &operator++()
60 one.setZeroInverted(mask);
63 Vc_INTRINSIC V &operator--()
66 one.setZeroInverted(mask);
71 Vc_INTRINSIC V operator++(
int)
77 Vc_INTRINSIC V operator--(
int)
84 #define Vc_OPERATOR_(op) \
85 template <typename U> Vc_ALWAYS_INLINE void operator op##=(U &&x) \
87 operator=(static_cast<V>(vec op std::forward<U>(x))); \
89 Vc_ALL_BINARY(Vc_OPERATOR_);
90 Vc_ALL_ARITHMETICS(Vc_OPERATOR_);
91 Vc_ALL_SHIFTS(Vc_OPERATOR_);
94 Vc_ALWAYS_INLINE
void operator=(
const V &x)
99 template <
typename T,
typename I,
typename S>
100 Vc_ALWAYS_INLINE
void operator=(SubscriptOperation<T, I, S, true> &&x)
102 vec.gather(x.gatherArguments(), mask);
105 template <
typename F> Vc_INTRINSIC
void call(
const F &f)
const
107 return vec.call(f, mask);
109 template <
typename F> Vc_INTRINSIC V apply(
const F &f)
const
111 return vec.apply(f, mask);
113 template <
typename F> Vc_INTRINSIC
void call(F &&f)
const
115 return vec.call(std::forward<F>(f), mask);
117 template <
typename F> Vc_INTRINSIC V apply(F &&f)
const
119 return vec.apply(std::forward<F>(f), mask);
137 #endif // VC_COMMON_WRITEMASKEDVECTOR_H_
constexpr VectorSpecialInitializerOne One
The special object Vc::One can be used to construct Vector and Mask objects initialized to one/true...