29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.8 basic_vec non-member operations [simd.nonmembers]

29.10.8.8 vec static permute [simd.permute.static]

template<simd-size-type N = see below, simd-vec-type V, class IdxMap> constexpr resize_t<N, V> permute(const V& v, IdxMap&& idxmap); template<simd-size-type N = see below, simd-mask-type M, class IdxMap> constexpr resize_t<N, M> permute(const M& v, IdxMap&& idxmap);
Let:
  • gen-fn(i) be idxmap(i, V​::​size()) if that expression is well-formed, and idxmap(i) otherwise.
  • perm-fn be the following exposition-only function template: template<simd-size-type I> typename V::value_type perm-fn() { constexpr auto src_index = gen-fn(I); if constexpr (src_index == zero_element) { return typename V::value_type(); } else if constexpr (src_index == uninit_element) { return unspecified-value; } else { return v[src_index]; } }
Constraints: integral<invoke_result_t<IdxMap&, simd-size-type>> || integral<invoke_result_t<IdxMap&, simd-size-type, simd-size-type>> is true.
Mandates: gen-fn(i) is a constant expression whose value is zero_element, uninit_element, or in the range [0, V​::​size()), for all i in the range [0, N).
Returns: A data-parallel object where the element is initialized to the result of perm-fn<i>() for all i in the range [0, N).
Remarks: The default argument for template parameter N is V​::​size().