29 #ifndef VC_COMMON_WRITEMASKEDVECTOR_H_
30 #define VC_COMMON_WRITEMASKEDVECTOR_H_
35 namespace Vc_VERSIONED_NAMESPACE
40 template <
typename V,
typename M =
typename V::Mask>
class WriteMaskedVector
44 "incorrect use of Vc::Common::WriteMaskedVector<V, M>. V and M must have the same «Size».");
48 static constexpr
size_t Size = V::Size;
50 Vc_FREE_STORE_OPERATORS_ALIGNED(
alignof(Mask))
53 Vc_INTRINSIC WriteMaskedVector(V *v, const Mask &k) : mask(k), vec(v)
58 Vc_INTRINSIC V &operator++()
61 one.setZeroInverted(mask);
64 Vc_INTRINSIC V &operator--()
67 one.setZeroInverted(mask);
72 Vc_INTRINSIC V operator++(
int)
78 Vc_INTRINSIC V operator--(
int)
85 #define Vc_OPERATOR__(op) \
86 template <typename U> Vc_ALWAYS_INLINE void operator op##=(U &&x) \
88 operator=(static_cast<V>(*vec op std::forward<U>(x))); \
90 Vc_ALL_BINARY(Vc_OPERATOR__)
91 Vc_ALL_ARITHMETICS(Vc_OPERATOR__)
92 Vc_ALL_SHIFTS(Vc_OPERATOR__)
95 Vc_ALWAYS_INLINE
void operator=(
const V &x)
100 template <
typename T,
typename I,
typename S>
101 Vc_ALWAYS_INLINE
void operator=(SubscriptOperation<T, I, S, true> &&x)
103 vec->gather(x.gatherArguments(), mask);
106 template <
typename F> Vc_INTRINSIC
void call(
const F &f)
const
108 return vec->call(f, mask);
110 template <
typename F> Vc_INTRINSIC V apply(
const F &f)
const
112 return vec->apply(f, mask);
114 template <
typename F> Vc_INTRINSIC
void call(F &&f)
const
116 return vec->call(std::forward<F>(f), mask);
118 template <
typename F> Vc_INTRINSIC V apply(F &&f)
const
120 return vec->apply(std::forward<F>(f), mask);
130 #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...