28 #ifndef VC_COMMON_SIMDIZE_H_ 29 #define VC_COMMON_SIMDIZE_H_ 89 namespace Vc_VERSIONED_NAMESPACE
97 namespace SimdizeDetail
104 using std::is_base_of;
105 using std::false_type;
106 using std::true_type;
107 using std::iterator_traits;
108 using std::conditional;
110 template <
bool B,
typename T,
typename F>
111 using conditional_t =
typename conditional<B, T, F>::type;
117 template <
typename... Ts>
struct Typelist;
122 enum class Category {
126 ArithmeticVectorizable,
134 BidirectionalIterator,
136 RandomAccessIterator,
145 template <
typename T,
typename ItCat =
typename T::iterator_category>
146 constexpr Category iteratorCategories(
int, ItCat * =
nullptr)
148 return is_base_of<std::random_access_iterator_tag, ItCat>::value
149 ? Category::RandomAccessIterator
150 : is_base_of<std::bidirectional_iterator_tag, ItCat>::value
151 ? Category::BidirectionalIterator
152 : is_base_of<std::forward_iterator_tag, ItCat>::value
153 ? Category::ForwardIterator
154 : is_base_of<std::output_iterator_tag, ItCat>::value
155 ? Category::OutputIterator
156 : is_base_of<std::input_iterator_tag, ItCat>::value
157 ? Category::InputIterator
163 template <
typename T>
164 constexpr enable_if<std::is_pointer<T>::value, Category> iteratorCategories(
float)
166 return Category::RandomAccessIterator;
171 template <
typename T> constexpr Category iteratorCategories(...)
173 return Category::None;
179 template <
typename T>
struct is_class_template :
public false_type
182 template <
template <
typename...>
class C,
typename... Ts>
183 struct is_class_template<C<Ts...>> :
public true_type
190 template <
typename T> constexpr Category typeCategory()
192 return (is_same<T, bool>::value || is_same<T, short>::value ||
193 is_same<T, unsigned short>::value || is_same<T, int>::value ||
194 is_same<T, unsigned int>::value || is_same<T, float>::value ||
195 is_same<T, double>::value)
196 ? Category::ArithmeticVectorizable
197 : iteratorCategories<T>(int()) != Category::None
198 ? iteratorCategories<T>(
int())
199 : is_class_template<T>::value ? Category::ClassTemplate
208 template <typename T, size_t TupleSize = std::tuple_size<T>::value>
209 constexpr
size_t determine_tuple_size()
213 template <
typename T,
size_t TupleSize = T::tuple_size>
214 constexpr
size_t determine_tuple_size(
size_t = T::tuple_size)
221 template <
typename T>
struct determine_tuple_size_
222 :
public std::integral_constant<size_t, determine_tuple_size<T>()>
227 template <
typename T>
struct The_simdization_for_the_requested_type_is_not_implemented;
242 template <
typename T,
size_t N,
typename MT, Category = typeCategory<T>()>
243 struct ReplaceTypes :
public The_simdization_for_the_requested_type_is_not_implemented<T>
251 template <
typename T,
size_t N,
typename MT>
struct ReplaceTypes<T, N, MT, Category::None>
260 template <
typename T,
size_t N = 0,
typename MT =
void>
261 using simdize =
typename SimdizeDetail::ReplaceTypes<T, N, MT>::type;
267 template <
typename T,
size_t N,
typename MT>
268 struct ReplaceTypes<T, N, MT, Category::ArithmeticVectorizable>
269 :
public conditional<(N == 0 || Vector<T>::Size == N), Vector<T>, SimdArray<T, N>>
277 template <
size_t N,
typename MT>
278 struct ReplaceTypes<bool, N, MT, Category::ArithmeticVectorizable>
279 :
public conditional<(N == 0 || Mask<MT>::Size == N), Mask<MT>,
280 SimdMaskArray<MT, N>>
287 struct ReplaceTypes<bool, N, void, Category::ArithmeticVectorizable>
288 :
public ReplaceTypes<bool, N, float, Category::ArithmeticVectorizable>
298 template <
size_t N,
typename MT,
typename Replaced,
typename... Remaining>
299 struct SubstituteOneByOne;
305 template <
size_t N,
typename MT,
typename... Replaced,
typename T,
306 typename... Remaining>
307 struct SubstituteOneByOne<N, MT, Typelist<Replaced...>, T, Remaining...>
314 template <
typename U,
size_t M = U::Size>
315 static std::integral_constant<size_t, M> size_or_0(
int);
316 template <
typename U>
static std::integral_constant<size_t, 0> size_or_0(...);
319 using V = simdize<T, N, MT>;
325 static constexpr
auto NewN = N != 0 ? N : decltype(size_or_0<V>(
int()))::value;
332 typedef conditional_t<(N != NewN && is_same<MT, void>::value),
333 conditional_t<is_same<T, bool>::value,
float, T>, MT> NewMT;
339 using type =
typename SubstituteOneByOne<NewN, NewMT, Typelist<Replaced..., V>,
345 template <
size_t Size,
typename... Replaced>
struct SubstitutedBase;
347 template <
typename Replaced>
struct SubstitutedBase<1, Replaced> {
348 template <
typename ValueT,
template <
typename, ValueT...>
class C, ValueT... Values>
349 using SubstitutedWithValues = C<Replaced, Values...>;
352 template <
typename R0,
typename R1>
struct SubstitutedBase<2, R0, R1>
354 template <
typename ValueT,
template <
typename,
typename, ValueT...>
class C,
356 using SubstitutedWithValues = C<R0, R1, Values...>;
359 template <
typename R0,
typename R1,
typename R2>
struct SubstitutedBase<3, R0, R1, R2>
361 template <
typename ValueT,
template <
typename,
typename,
typename, ValueT...>
class C,
363 using SubstitutedWithValues = C<R0, R1, R2, Values...>;
365 #if defined Vc_ICC || defined Vc_MSVC 366 #define Vc_VALUE_PACK_EXPANSION_IS_BROKEN 1 368 template <
typename... Replaced>
struct SubstitutedBase<4, Replaced...> {
370 #ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN 371 template <
typename ValueT,
372 template <
typename,
typename,
typename,
typename, ValueT...>
class C,
374 using SubstitutedWithValues = C<Replaced..., Values...>;
375 #endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN 378 template <
typename... Replaced>
struct SubstitutedBase<5, Replaced...> {
379 #ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN 380 template <
typename ValueT,
template <
typename,
typename,
typename,
typename,
typename,
383 using SubstitutedWithValues = C<Replaced..., Values...>;
384 #endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN 387 template <
typename... Replaced>
struct SubstitutedBase<6, Replaced...> {
388 #ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN 389 template <
typename ValueT,
template <
typename,
typename,
typename,
typename,
typename,
390 typename, ValueT...>
class C,
392 using SubstitutedWithValues = C<Replaced..., Values...>;
393 #endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN 396 template <
typename... Replaced>
struct SubstitutedBase<7, Replaced...> {
397 #ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN 398 template <
typename ValueT,
template <
typename,
typename,
typename,
typename,
typename,
399 typename,
typename, ValueT...>
class C,
401 using SubstitutedWithValues = C<Replaced..., Values...>;
402 #endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN 405 template <
typename... Replaced>
struct SubstitutedBase<8, Replaced...> {
406 #ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN 407 template <
typename ValueT,
template <
typename,
typename,
typename,
typename,
typename,
408 typename,
typename,
typename, ValueT...>
class C,
410 using SubstitutedWithValues = C<Replaced..., Values...>;
411 #endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN 419 template <
size_t N_,
typename MT,
typename Replaced0,
typename... Replaced>
420 struct SubstituteOneByOne<N_, MT, Typelist<Replaced0, Replaced...>>
426 :
public SubstitutedBase<sizeof...(Replaced) + 1, Replaced0, Replaced...> {
427 static constexpr
auto N = N_;
432 template <
template <
typename...>
class C>
433 using Substituted = C<Replaced0, Replaced...>;
453 template <
typename Scalar,
typename Base,
size_t N>
class Adapter;
459 template <
template <
typename...>
class C,
typename... Ts,
size_t N,
typename MT>
460 struct ReplaceTypes<C<Ts...>, N, MT, Category::ClassTemplate>
463 using SubstitutionResult =
464 typename SubstituteOneByOne<N, MT, Typelist<>, Ts...>::type;
470 using Vectorized =
typename SubstitutionResult::template Substituted<C>;
476 using type = conditional_t<is_same<C<Ts...>, Vectorized>::value, C<Ts...>,
477 Adapter<C<Ts...>, Vectorized, SubstitutionResult::N>>;
485 #ifdef Vc_VALUE_PACK_EXPANSION_IS_BROKEN 487 #define Vc_DEFINE_NONTYPE_REPLACETYPES_(ValueType_) \ 488 template <template <typename, ValueType_...> class C, typename T, ValueType_ Value0, \ 489 ValueType_... Values> \ 490 struct is_class_template<C<T, Value0, Values...>> : public true_type { \ 492 template <template <typename, typename, ValueType_...> class C, typename T0, \ 493 typename T1, ValueType_ Value0, ValueType_... Values> \ 494 struct is_class_template<C<T0, T1, Value0, Values...>> : public true_type { \ 496 template <template <typename, typename, typename, ValueType_...> class C, \ 497 typename T0, typename T1, typename T2, ValueType_ Value0, \ 498 ValueType_... Values> \ 499 struct is_class_template<C<T0, T1, T2, Value0, Values...>> : public true_type { \ 501 template <template <typename, typename, typename, typename, ValueType_...> class C, \ 502 typename T0, typename T1, typename T2, typename T3, ValueType_ Value0, \ 503 ValueType_... Values> \ 504 struct is_class_template<C<T0, T1, T2, T3, Value0, Values...>> : public true_type { \ 506 template <template <typename, typename, typename, typename, typename, ValueType_...> \ 508 typename T0, typename T1, typename T2, typename T3, typename T4, \ 509 ValueType_ Value0, ValueType_... Values> \ 510 struct is_class_template<C<T0, T1, T2, T3, T4, Value0, Values...>> \ 511 : public true_type { \ 513 template <template <typename, typename, typename, typename, typename, typename, \ 514 ValueType_...> class C, \ 515 typename T0, typename T1, typename T2, typename T3, typename T4, \ 516 typename T5, ValueType_ Value0, ValueType_... Values> \ 517 struct is_class_template<C<T0, T1, T2, T3, T4, T5, Value0, Values...>> \ 518 : public true_type { \ 520 template <template <typename, typename, typename, typename, typename, typename, \ 521 typename, ValueType_...> class C, \ 522 typename T0, typename T1, typename T2, typename T3, typename T4, \ 523 typename T5, typename T6, ValueType_ Value0, ValueType_... Values> \ 524 struct is_class_template<C<T0, T1, T2, T3, T4, T5, T6, Value0, Values...>> \ 525 : public true_type { \ 527 template <template <typename, ValueType_> class C, typename T0, ValueType_ Value0, \ 528 size_t N, typename MT> \ 529 struct ReplaceTypes<C<T0, Value0>, N, MT, Category::ClassTemplate> { \ 530 typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0>::type tmp; \ 531 typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0> \ 533 static constexpr auto NN = tmp::N; \ 534 typedef conditional_t<is_same<C<T0, Value0>, Substituted>::value, C<T0, Value0>, \ 535 Adapter<C<T0, Value0>, Substituted, NN>> type; \ 537 template <template <typename, typename, ValueType_> class C, typename T0, \ 538 typename T1, ValueType_ Value0, size_t N, typename MT> \ 539 struct ReplaceTypes<C<T0, T1, Value0>, N, MT, Category::ClassTemplate> { \ 540 typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1>::type tmp; \ 541 typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0> \ 543 static constexpr auto NN = tmp::N; \ 544 typedef conditional_t<is_same<C<T0, T1, Value0>, Substituted>::value, \ 546 Adapter<C<T0, T1, Value0>, Substituted, NN>> type; \ 548 template <template <typename, typename, typename, ValueType_> class C, typename T0, \ 549 typename T1, typename T2, ValueType_ Value0, size_t N, typename MT> \ 550 struct ReplaceTypes<C<T0, T1, T2, Value0>, N, MT, Category::ClassTemplate> { \ 551 typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1, T2>::type tmp; \ 552 typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0> \ 554 static constexpr auto NN = tmp::N; \ 555 typedef conditional_t<is_same<C<T0, T1, T2, Value0>, Substituted>::value, \ 556 C<T0, T1, T2, Value0>, \ 557 Adapter<C<T0, T1, T2, Value0>, Substituted, NN>> type; \ 560 #define Vc_DEFINE_NONTYPE_REPLACETYPES_(ValueType_) \ 561 template <template <typename, ValueType_...> class C, typename T, ValueType_ Value0, \ 562 ValueType_... Values> \ 563 struct is_class_template<C<T, Value0, Values...>> : public true_type { \ 565 template <template <typename, typename, ValueType_...> class C, typename T0, \ 566 typename T1, ValueType_ Value0, ValueType_... Values> \ 567 struct is_class_template<C<T0, T1, Value0, Values...>> : public true_type { \ 569 template <template <typename, typename, typename, ValueType_...> class C, \ 570 typename T0, typename T1, typename T2, ValueType_ Value0, \ 571 ValueType_... Values> \ 572 struct is_class_template<C<T0, T1, T2, Value0, Values...>> : public true_type { \ 574 template <template <typename, typename, typename, typename, ValueType_...> class C, \ 575 typename T0, typename T1, typename T2, typename T3, ValueType_ Value0, \ 576 ValueType_... Values> \ 577 struct is_class_template<C<T0, T1, T2, T3, Value0, Values...>> : public true_type { \ 579 template <template <typename, typename, typename, typename, typename, ValueType_...> \ 581 typename T0, typename T1, typename T2, typename T3, typename T4, \ 582 ValueType_ Value0, ValueType_... Values> \ 583 struct is_class_template<C<T0, T1, T2, T3, T4, Value0, Values...>> \ 584 : public true_type { \ 586 template <template <typename, typename, typename, typename, typename, typename, \ 587 ValueType_...> class C, \ 588 typename T0, typename T1, typename T2, typename T3, typename T4, \ 589 typename T5, ValueType_ Value0, ValueType_... Values> \ 590 struct is_class_template<C<T0, T1, T2, T3, T4, T5, Value0, Values...>> \ 591 : public true_type { \ 593 template <template <typename, typename, typename, typename, typename, typename, \ 594 typename, ValueType_...> class C, \ 595 typename T0, typename T1, typename T2, typename T3, typename T4, \ 596 typename T5, typename T6, ValueType_ Value0, ValueType_... Values> \ 597 struct is_class_template<C<T0, T1, T2, T3, T4, T5, T6, Value0, Values...>> \ 598 : public true_type { \ 600 template <template <typename, ValueType_...> class C, typename T0, \ 601 ValueType_ Value0, ValueType_... Values, size_t N, typename MT> \ 602 struct ReplaceTypes<C<T0, Value0, Values...>, N, MT, Category::ClassTemplate> { \ 603 typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0>::type tmp; \ 604 typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0, \ 605 Values...> Substituted; \ 606 static constexpr auto NN = tmp::N; \ 607 typedef conditional_t<is_same<C<T0, Value0, Values...>, Substituted>::value, \ 608 C<T0, Value0, Values...>, \ 609 Adapter<C<T0, Value0, Values...>, Substituted, NN>> type; \ 611 template <template <typename, typename, ValueType_...> class C, typename T0, \ 612 typename T1, ValueType_ Value0, ValueType_... Values, size_t N, \ 614 struct ReplaceTypes<C<T0, T1, Value0, Values...>, N, MT, Category::ClassTemplate> { \ 615 typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1>::type tmp; \ 616 typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0, \ 617 Values...> Substituted; \ 618 static constexpr auto NN = tmp::N; \ 619 typedef conditional_t<is_same<C<T0, T1, Value0, Values...>, Substituted>::value, \ 620 C<T0, T1, Value0, Values...>, \ 621 Adapter<C<T0, T1, Value0, Values...>, Substituted, NN>> \ 624 template <template <typename, typename, typename, ValueType_...> class C, \ 625 typename T0, typename T1, typename T2, ValueType_ Value0, \ 626 ValueType_... Values, size_t N, typename MT> \ 627 struct ReplaceTypes<C<T0, T1, T2, Value0, Values...>, N, MT, \ 628 Category::ClassTemplate> { \ 629 typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1, T2>::type tmp; \ 630 typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0, \ 631 Values...> Substituted; \ 632 static constexpr auto NN = tmp::N; \ 633 typedef conditional_t< \ 634 is_same<C<T0, T1, T2, Value0, Values...>, Substituted>::value, \ 635 C<T0, T1, T2, Value0, Values...>, \ 636 Adapter<C<T0, T1, T2, Value0, Values...>, Substituted, NN>> type; \ 638 #endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN 639 Vc_DEFINE_NONTYPE_REPLACETYPES_(
bool);
640 Vc_DEFINE_NONTYPE_REPLACETYPES_(
wchar_t);
641 Vc_DEFINE_NONTYPE_REPLACETYPES_(
char);
642 Vc_DEFINE_NONTYPE_REPLACETYPES_(
signed char);
643 Vc_DEFINE_NONTYPE_REPLACETYPES_(
unsigned char);
644 Vc_DEFINE_NONTYPE_REPLACETYPES_(
signed short);
645 Vc_DEFINE_NONTYPE_REPLACETYPES_(
unsigned short);
646 Vc_DEFINE_NONTYPE_REPLACETYPES_(
signed int);
647 Vc_DEFINE_NONTYPE_REPLACETYPES_(
unsigned int);
648 Vc_DEFINE_NONTYPE_REPLACETYPES_(
signed long);
649 Vc_DEFINE_NONTYPE_REPLACETYPES_(
unsigned long);
650 Vc_DEFINE_NONTYPE_REPLACETYPES_(
signed long long);
651 Vc_DEFINE_NONTYPE_REPLACETYPES_(
unsigned long long);
652 #undef Vc_DEFINE_NONTYPE_REPLACETYPES_ 654 namespace is_constructible_with_single_paren_impl
656 template <
typename T> T create();
657 #if defined Vc_CLANG || defined Vc_APPLECLANG 658 template <
typename Class,
typename... Args,
typename = decltype(Class(create<Args>()...))>
661 template <
typename Class,
typename... Args>
662 typename std::conditional<
666 sizeof(Class(create<Args>()...)),
670 template <
typename Class,
typename... Args>
double test(...);
673 template <
typename Class,
typename... Args>
674 struct is_constructible_with_single_paren
675 :
public std::integral_constant<
677 1 == sizeof(is_constructible_with_single_paren_impl::test<Class, Args...>(1))> {
680 namespace is_constructible_with_single_brace_impl
682 template <
typename T> T create();
684 template <
typename Class,
typename... Args>
char test(
int);
685 #elif defined Vc_CLANG || defined Vc_APPLECLANG 686 template <
typename Class,
typename... Args,
typename = decltype(Class{create<Args>()...})>
689 template <
typename Class,
typename... Args>
690 typename std::conditional<
694 sizeof(Class{create<Args>()...}),
698 template <
typename Class,
typename... Args>
double test(...);
701 template <
typename Class,
typename... Args>
702 struct is_constructible_with_single_brace
703 :
public std::integral_constant<
705 1 == sizeof(is_constructible_with_single_brace_impl::test<Class, Args...>(1))> {
708 namespace is_constructible_with_double_brace_impl
710 template <
typename T> T create();
711 #if defined Vc_CLANG || defined Vc_APPLECLANG 712 template <
typename Class,
typename... Args,
713 typename = decltype(Class{{create<Args>()...}})>
716 template <
typename Class,
typename... Args>
717 typename std::conditional<
721 sizeof(Class{{create<Args>()...}}),
725 template <
typename Class,
typename... Args>
double test(...);
728 template <
typename Class,
typename... Args>
729 struct is_constructible_with_double_brace
730 :
public std::integral_constant<
732 1 == sizeof(is_constructible_with_double_brace_impl::test<Class, Args...>(1))> {
735 template <
size_t I,
typename T,
736 typename R = decltype(std::declval<T &>().
template vc_get_<I>())>
737 R get_dispatcher(T &x,
void * =
nullptr)
739 return x.template vc_get_<I>();
741 template <
size_t I,
typename T,
742 typename R = decltype(std::declval<const T &>().
template vc_get_<I>())>
743 R get_dispatcher(
const T &x,
void * =
nullptr)
745 return x.template vc_get_<I>();
747 template <
size_t I,
typename T,
typename R = decltype(std::get<I>(std::declval<T &>()))>
748 R get_dispatcher(T &x,
int = 0)
750 return std::get<I>(x);
752 template <
size_t I,
typename T,
753 typename R = decltype(std::get<I>(std::declval<const T &>()))>
754 R get_dispatcher(
const T &x,
int = 0)
756 return std::get<I>(x);
761 template <
typename Scalar,
typename Base,
size_t N>
class Adapter :
public Base
765 template <std::size_t... Indexes,
typename T>
766 Adapter(Vc::index_sequence<Indexes...>,
const Scalar &x_, T, std::true_type)
767 : Base{{get_dispatcher<Indexes>(x_)...}}
772 template <std::size_t... Indexes>
773 Adapter(Vc::index_sequence<Indexes...>,
const Scalar &x_, std::false_type,
775 : Base{get_dispatcher<Indexes>(x_)...}
780 template <std::size_t... Indexes>
781 Adapter(Vc::index_sequence<Indexes...>,
const Scalar &x_, std::true_type,
783 : Base(get_dispatcher<Indexes>(x_)...)
787 template <std::size_t... Indexes>
788 Adapter(Vc::index_sequence<Indexes...> seq_,
const Scalar &x_)
790 std::integral_constant<
791 bool, is_constructible_with_single_paren<
792 Base, decltype(get_dispatcher<Indexes>(
793 std::declval<const Scalar &>()))...>::value>(),
794 std::integral_constant<
795 bool, is_constructible_with_double_brace<
796 Base, decltype(get_dispatcher<Indexes>(
797 std::declval<const Scalar &>()))...>::value>())
803 static constexpr
size_t size() {
return N; }
804 static constexpr
size_t Size = N;
807 using base_type = Base;
810 using scalar_type = Scalar;
817 #if defined Vc_CLANG && Vc_CLANG < 0x30700 818 Vc_INTRINSIC Adapter(
const Adapter &x) : Base(x) {}
820 Adapter(
const Adapter &) =
default;
822 Adapter(Adapter &&) =
default;
825 Adapter &operator=(
const Adapter &) =
default;
827 Adapter &operator=(Adapter &&) =
default;
830 template <typename U, size_t TupleSize = determine_tuple_size_<Scalar>::value,
831 typename Seq = Vc::make_index_sequence<TupleSize>,
832 typename = enable_if<std::is_convertible<U, Scalar>::value>>
834 : Adapter(Seq(), static_cast<const Scalar &>(x_))
839 template <
typename A0,
typename... Args,
840 typename =
typename std::enable_if<
841 !Traits::is_index_sequence<A0>::value &&
842 (
sizeof...(Args) > 0 || !std::is_convertible<A0, Scalar>::value)>::type>
843 Adapter(A0 &&arg0_, Args &&... arguments_)
844 : Base(
std::forward<A0>(arg0_),
std::forward<Args>(arguments_)...)
849 template <
typename T,
850 typename = decltype(Base(std::declval<
const std::initializer_list<T> &>()))>
851 Adapter(
const std::initializer_list<T> &l_)
858 void *
operator new(
size_t size)
860 return Vc::Common::aligned_malloc<alignof(Adapter)>(size);
862 void *
operator new(size_t,
void *p_) {
return p_; }
863 void *
operator new[](
size_t size)
865 return Vc::Common::aligned_malloc<alignof(Adapter)>(size);
867 void *
operator new[](size_t ,
void *p_) {
return p_; }
869 void operator delete(
void *,
void *) {}
871 void operator delete[](
void *,
void *) {}
878 template <
class... TTypes,
class... TTypesV,
class... UTypes,
class... UTypesV,
size_t N>
879 inline void operator==(
880 const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,
881 const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) =
delete;
882 template <
class... TTypes,
class... TTypesV,
class... UTypes,
class... UTypesV,
size_t N>
883 inline void operator!=(
884 const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,
885 const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) =
delete;
886 template <
class... TTypes,
class... TTypesV,
class... UTypes,
class... UTypesV,
size_t N>
887 inline void operator<=(
888 const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,
889 const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) =
delete;
890 template <
class... TTypes,
class... TTypesV,
class... UTypes,
class... UTypesV,
size_t N>
891 inline void operator>=(
892 const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,
893 const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) =
delete;
894 template <
class... TTypes,
class... TTypesV,
class... UTypes,
class... UTypesV,
size_t N>
895 inline void operator<(
896 const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,
897 const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) =
delete;
898 template <
class... TTypes,
class... TTypesV,
class... UTypes,
class... UTypesV,
size_t N>
899 inline void operator>(
900 const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,
901 const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) =
delete;
912 template <
typename Scalar,
typename Base,
size_t N>
913 class tuple_size<
Vc::SimdizeDetail::Adapter<Scalar, Base, N>> :
public tuple_size<Base>
919 template <
size_t I,
typename Scalar,
typename Base,
size_t N>
920 class tuple_element<I,
Vc::SimdizeDetail::Adapter<Scalar, Base, N>>
921 :
public tuple_element<I, Base>
931 template <
typename S,
typename T,
size_t N>
932 class allocator<
Vc::SimdizeDetail::Adapter<S, T, N>>
936 template <
typename U>
struct rebind
938 typedef std::allocator<U> other;
943 namespace Vc_VERSIONED_NAMESPACE
945 namespace SimdizeDetail
955 template <
typename T>
static inline T decay_workaround(
const T &x) {
return x; }
960 template <
typename S,
typename T,
size_t N,
size_t... Indexes>
961 inline void assign_impl(Adapter<S, T, N> &a,
size_t i,
const S &x,
962 Vc::index_sequence<Indexes...>)
964 const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(x)))...> tmp(
965 decay_workaround(get_dispatcher<Indexes>(x))...);
966 auto &&unused = {(get_dispatcher<Indexes>(a)[i] = get_dispatcher<Indexes>(tmp), 0)...};
967 if (&unused == &unused) {}
974 template <
typename S,
typename T,
size_t N>
975 inline void assign(Adapter<S, T, N> &a,
size_t i,
const S &x)
977 assign_impl(a, i, x, Vc::make_index_sequence<determine_tuple_size<T>()>());
982 template <typename V, typename = enable_if<Traits::is_simd_vector<V>::value>>
983 Vc_INTRINSIC
void assign(V &v,
size_t i,
typename V::EntryType x)
991 template <
typename S,
typename T,
size_t N,
size_t... Indexes>
992 inline S extract_impl(
const Adapter<S, T, N> &a,
size_t i, Vc::index_sequence<Indexes...>)
994 const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(a)[i]))...> tmp(
995 decay_workaround(get_dispatcher<Indexes>(a)[i])...);
996 return S(get_dispatcher<Indexes>(tmp)...);
1003 template <
typename S,
typename T,
size_t N>
1004 inline S
extract(
const Adapter<S, T, N> &a,
size_t i)
1006 return extract_impl(a, i, Vc::make_index_sequence<determine_tuple_size<S>()>());
1011 template <typename V, typename = enable_if<Traits::is_simd_vector<V>::value>>
1012 Vc_INTRINSIC
typename V::EntryType extract(
const V &v,
size_t i)
1017 template <
typename S,
typename T, std::size_t N, std::size_t... Indexes>
1018 inline Adapter<S, T, N> shifted_impl(
const Adapter<S, T, N> &a,
int shift,
1019 Vc::index_sequence<Indexes...>)
1022 auto &&unused = {(get_dispatcher<Indexes>(r) = get_dispatcher<Indexes>(a).shifted(shift), 0)...};
1023 if (&unused == &unused) {}
1035 template <
typename S,
typename T,
size_t N>
1036 inline Adapter<S, T, N>
shifted(
const Adapter<S, T, N> &a,
int shift)
1038 return shifted_impl(a, shift, Vc::make_index_sequence<determine_tuple_size<T>()>());
1044 template <
typename S,
typename T, std::size_t N, std::size_t... Indexes>
1045 inline void swap_impl(Adapter<S, T, N> &a, std::size_t i, S &x,
1046 Vc::index_sequence<Indexes...>)
1048 const auto &a_const = a;
1049 const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(a_const)[0]))...>
1050 tmp{decay_workaround(get_dispatcher<Indexes>(a_const)[i])...};
1051 auto &&unused = {(get_dispatcher<Indexes>(a)[i] = get_dispatcher<Indexes>(x), 0)...};
1052 auto &&unused2 = {(get_dispatcher<Indexes>(x) = get_dispatcher<Indexes>(tmp), 0)...};
1053 if (&unused == &unused2) {}
1055 template <
typename S,
typename T, std::size_t N, std::size_t... Indexes>
1056 inline void swap_impl(Adapter<S, T, N> &a, std::size_t i, Adapter<S, T, N> &b,
1057 std::size_t j, Vc::index_sequence<Indexes...>)
1059 const auto &a_const = a;
1060 const auto &b_const = b;
1061 const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(a_const)[0]))...>
1062 tmp{decay_workaround(get_dispatcher<Indexes>(a_const)[i])...};
1063 auto &&unused = {(get_dispatcher<Indexes>(a)[i] = get_dispatcher<Indexes>(b_const)[j], 0)...};
1064 auto &&unused2 = {(get_dispatcher<Indexes>(b)[j] = get_dispatcher<Indexes>(tmp), 0)...};
1065 if (&unused == &unused2) {}
1072 template <
typename S,
typename T, std::
size_t N>
1073 inline void swap(Adapter<S, T, N> &a, std::size_t i, S &x)
1075 swap_impl(a, i, x, Vc::make_index_sequence<determine_tuple_size<T>()>());
1077 template <
typename S,
typename T, std::
size_t N>
1078 inline void swap(Adapter<S, T, N> &a, std::size_t i, Adapter<S, T, N> &b, std::size_t j)
1080 swap_impl(a, i, b, j, Vc::make_index_sequence<determine_tuple_size<T>()>());
1083 template <
typename A>
class Scalar
1085 using reference =
typename std::add_lvalue_reference<A>::type;
1086 using S =
typename A::scalar_type;
1087 using IndexSeq = Vc::make_index_sequence<determine_tuple_size<S>()>;
1090 Scalar(reference aa,
size_t ii) : a(aa), i(ii) {}
1093 Scalar(
const Scalar &) =
delete;
1094 Scalar(Scalar &&) =
delete;
1095 Scalar &operator=(
const Scalar &) =
delete;
1096 Scalar &operator=(Scalar &&) =
delete;
1098 void operator=(
const S &x) { assign_impl(a, i, x, IndexSeq()); }
1099 operator S()
const {
return extract_impl(a, i, IndexSeq()); }
1101 template <
typename AA>
1102 friend inline void swap(Scalar<AA> &&a,
typename AA::scalar_type &b);
1103 template <
typename AA>
1104 friend inline void swap(
typename AA::scalar_type &b, Scalar<AA> &&a);
1105 template <
typename AA>
friend inline void swap(Scalar<AA> &&a, Scalar<AA> &&b);
1114 template <
typename A>
inline void swap(Scalar<A> &&a,
typename A::scalar_type &b)
1116 swap_impl(a.a, a.i, b,
typename Scalar<A>::IndexSeq());
1120 template <
typename A>
inline void swap(
typename A::scalar_type &b, Scalar<A> &&a)
1122 swap_impl(a.a, a.i, b,
typename Scalar<A>::IndexSeq());
1125 template <
typename A>
inline void swap(Scalar<A> &&a, Scalar<A> &&b)
1127 swap_impl(a.a, a.i, b.a, b.i,
typename Scalar<A>::IndexSeq());
1130 template <
typename A>
class Interface
1132 using reference =
typename std::add_lvalue_reference<A>::type;
1134 Vc::make_index_sequence<determine_tuple_size<typename A::scalar_type>()>;
1137 Interface(reference aa) : a(aa) {}
1139 Scalar<A> operator[](
size_t i)
1143 typename A::scalar_type operator[](
size_t i)
const 1145 return extract_impl(a, i, IndexSeq());
1150 return shifted_impl(a, amount, IndexSeq());
1157 template <
typename S,
typename T,
size_t N>
1158 Interface<Adapter<S, T, N>> decorate(Adapter<S, T, N> &a)
1162 template <
typename S,
typename T,
size_t N>
1163 const Interface<const Adapter<S, T, N>> decorate(
const Adapter<S, T, N> &a)
1168 namespace IteratorDetails
1170 enum class Mutable { Yes, No };
1172 template <
typename It,
typename V,
size_t I,
size_t End>
1173 Vc_INTRINSIC V fromIteratorImpl(enable_if<(I == End), It>)
1177 template <
typename It,
typename V,
size_t I,
size_t End>
1178 Vc_INTRINSIC V fromIteratorImpl(enable_if<(I < End), It> it)
1180 V r = fromIteratorImpl<It, V, I + 1, End>(it);
1181 Traits::decay<decltype(get_dispatcher<I>(r))> tmp;
1182 for (
size_t j = 0; j < V::size(); ++j, ++it) {
1183 tmp[j] = get_dispatcher<I>(*it);
1185 get_dispatcher<I>(r) = tmp;
1188 template <
typename It,
typename V>
1189 Vc_INTRINSIC V fromIterator(enable_if<!Traits::is_simd_vector<V>::value,
const It &> it)
1191 return fromIteratorImpl<It, V, 0, determine_tuple_size<V>()>(it);
1193 template <
typename It,
typename V>
1194 Vc_INTRINSIC V fromIterator(enable_if<Traits::is_simd_vector<V>::value, It> it)
1197 for (
size_t j = 0; j < V::size(); ++j, ++it) {
1206 template <
typename T,
typename value_vector, Mutable>
class Pointer;
1216 template <
typename T,
typename value_vector>
class Pointer<T, value_vector, Mutable::Yes>
1218 static constexpr
auto Size = value_vector::size();
1222 value_vector *operator->() {
return &data; }
1229 Pointer(
const Pointer &) =
delete;
1230 Pointer &operator=(
const Pointer &) =
delete;
1231 Pointer &operator=(Pointer &&) =
delete;
1234 Pointer(Pointer &&) =
default;
1244 for (
size_t i = 0; i < Size; ++i, ++begin_iterator) {
1245 *begin_iterator =
extract(data, i);
1250 Pointer(
const T &it) : data(fromIterator<T, value_vector>(it)), begin_iterator(it) {}
1263 template <
typename T,
typename value_vector>
class Pointer<T, value_vector, Mutable::No>
1265 static constexpr
auto Size = value_vector::size();
1268 const value_vector *operator->()
const {
return &data; }
1271 Pointer(
const Pointer &) =
delete;
1272 Pointer &operator=(
const Pointer &) =
delete;
1273 Pointer &operator=(Pointer &&) =
delete;
1275 Pointer(Pointer &&) =
default;
1277 Pointer(
const T &it) : data(fromIterator<T, value_vector>(it)) {}
1295 template <
typename T,
typename value_vector, Mutable M>
class Reference;
1298 template <
typename T,
typename value_vector>
1299 class Reference<T, value_vector, Mutable::Yes> :
public value_vector
1301 static constexpr
auto Size = value_vector::size();
1303 using reference =
typename std::add_lvalue_reference<T>::type;
1304 reference scalar_it;
1309 Reference(reference first_it)
1310 : value_vector(fromIterator<T, value_vector>(first_it)), scalar_it(first_it)
1315 Reference(
const Reference &) =
delete;
1316 Reference(Reference &&) =
default;
1317 Reference &operator=(
const Reference &) =
delete;
1318 Reference &operator=(Reference &&) =
delete;
1325 void operator=(
const value_vector &x)
1327 static_cast<value_vector &
>(*this) = x;
1328 auto it = scalar_it;
1329 for (
size_t i = 0; i < Size; ++i, ++it) {
1334 #define Vc_OP(op_) \ 1335 template <typename T0, typename V0, typename T1, typename V1> \ 1336 decltype(std::declval<const V0 &>() op_ std::declval<const V1 &>()) operator op_( \ 1337 const Reference<T0, V0, Mutable::Yes> &x, \ 1338 const Reference<T1, V1, Mutable::Yes> &y) \ 1340 return static_cast<const V0 &>(x) op_ static_cast<const V1 &>(y); \ 1342 Vc_ALL_COMPARES(Vc_OP);
1343 Vc_ALL_ARITHMETICS(Vc_OP);
1344 Vc_ALL_BINARY(Vc_OP);
1345 Vc_ALL_LOGICAL(Vc_OP);
1346 Vc_ALL_SHIFTS(Vc_OP);
1350 template <
typename T,
typename value_vector>
1351 class Reference<T, value_vector, Mutable::No> :
public value_vector
1353 static constexpr
auto Size = value_vector::size();
1356 Reference(
const T &it) : value_vector(fromIterator<T, value_vector>(it)) {}
1358 Reference(
const Reference &) =
delete;
1359 Reference(Reference &&) =
default;
1360 Reference &operator=(
const Reference &) =
delete;
1361 Reference &operator=(Reference &&) =
delete;
1364 void operator=(
const value_vector &x) =
delete;
1367 template <
typename T,
size_t N,
1368 IteratorDetails::Mutable M =
1369 (Traits::is_output_iterator<T>::value ? Mutable::Yes : Mutable::No),
1370 typename V =
simdize<
typename std::iterator_traits<T>::value_type, N>,
1371 size_t Size = V::Size,
1372 typename =
typename std::iterator_traits<T>::iterator_category>
1375 template <
typename T,
size_t N, IteratorDetails::Mutable M,
typename V,
size_t Size_>
1376 class Iterator<T, N, M, V, Size_, std::forward_iterator_tag>
1377 :
public std::iterator<typename std::iterator_traits<T>::iterator_category, V,
1378 typename std::iterator_traits<T>::difference_type,
1379 IteratorDetails::Pointer<T, V, M>,
1380 IteratorDetails::Reference<T, V, M>>
1383 using pointer = IteratorDetails::Pointer<T, V, M>;
1384 using reference = IteratorDetails::Reference<T, V, M>;
1385 using const_pointer = IteratorDetails::Pointer<T, V, IteratorDetails::Mutable::No>;
1386 using const_reference =
1387 IteratorDetails::Reference<T, V, IteratorDetails::Mutable::No>;
1390 static constexpr std::size_t size() {
return Size_; }
1391 static constexpr std::size_t Size = Size_;
1393 Iterator() =
default;
1401 Iterator(
const T &x) : scalar_it(x) {}
1405 Iterator(T &&x) : scalar_it(
std::move(x)) {}
1409 Iterator &operator=(
const T &x)
1417 Iterator &operator=(T &&x)
1419 scalar_it = std::move(x);
1424 Iterator(
const Iterator &) =
default;
1426 Iterator(Iterator &&) =
default;
1428 Iterator &operator=(
const Iterator &) =
default;
1430 Iterator &operator=(Iterator &&) =
default;
1433 Iterator &operator++()
1435 std::advance(scalar_it, Size);
1439 Iterator operator++(
int)
1441 Iterator copy(*
this);
1454 bool operator==(
const Iterator &rhs)
const 1457 if (scalar_it == rhs.scalar_it) {
1461 for (
size_t i = 1; i < Size; ++i) {
1462 Vc_ASSERT((++it != rhs.scalar_it));
1467 return scalar_it == rhs.scalar_it;
1478 bool operator!=(
const Iterator &rhs)
const 1480 return !operator==(rhs);
1483 pointer operator->() {
return scalar_it; }
1491 reference
operator*() {
return scalar_it; }
1493 const_pointer operator->()
const {
return scalar_it; }
1502 const_reference
operator*()
const {
return scalar_it; }
1517 operator const T &()
const {
return scalar_it; }
1527 template <
typename T,
size_t N, IteratorDetails::Mutable M,
typename V,
size_t Size>
1528 class Iterator<T, N, M, V, Size,
std::bidirectional_iterator_tag>
1529 :
public Iterator<T, N, M, V, Size, std::forward_iterator_tag>
1531 using Base = Iterator<T, N, M, V, Size, std::forward_iterator_tag>;
1534 using Base::scalar_it;
1537 using pointer =
typename Base::pointer;
1538 using reference =
typename Base::reference;
1539 using const_pointer =
typename Base::const_pointer;
1540 using const_reference =
typename Base::const_reference;
1542 using Iterator<T, N, M, V, Size,
1543 std::forward_iterator_tag>::Iterator;
1549 std::advance(scalar_it, -Size);
1555 Iterator copy(*
this);
1565 template <
typename T,
size_t N, IteratorDetails::Mutable M,
typename V,
size_t Size>
1566 class Iterator<T, N, M, V, Size,
std::random_access_iterator_tag>
1567 :
public Iterator<T, N, M, V, Size, std::bidirectional_iterator_tag>
1572 using Base::scalar_it;
1575 using pointer =
typename Base::pointer;
1576 using reference =
typename Base::reference;
1577 using const_pointer =
typename Base::const_pointer;
1578 using const_reference =
typename Base::const_reference;
1579 using difference_type =
typename std::iterator_traits<T>::difference_type;
1584 Iterator &operator+=(difference_type n)
1586 scalar_it += n * difference_type(Size);
1589 Iterator
operator+(difference_type n)
const {
return Iterator(*
this) += n; }
1591 Iterator &operator-=(difference_type n)
1593 scalar_it -= n * difference_type(Size);
1596 Iterator
operator-(difference_type n)
const {
return Iterator(*
this) -= n; }
1598 difference_type
operator-(
const Iterator &rhs)
const 1600 constexpr difference_type n = Size;
1601 Vc_ASSERT((scalar_it - rhs.scalar_it) % n ==
1607 return (scalar_it - rhs.scalar_it) / n;
1616 return rhs.scalar_it - scalar_it >= difference_type(Size);
1619 bool operator>(
const Iterator &rhs)
const 1621 return scalar_it - rhs.scalar_it >= difference_type(Size);
1624 bool operator<=(
const Iterator &rhs)
const 1626 return rhs.scalar_it - scalar_it >= difference_type(Size) - 1;
1629 bool operator>=(
const Iterator &rhs)
const 1631 return scalar_it - rhs.scalar_it >= difference_type(Size) - 1;
1634 reference operator[](difference_type i) {
return *(*
this + i); }
1635 const_reference operator[](difference_type i)
const {
return *(*
this + i); }
1638 template <
typename T,
size_t N, IteratorDetails::Mutable M,
typename V,
size_t Size>
1639 Iterator<T, N, M, V, Size, std::random_access_iterator_tag>
operator+(
1640 typename Iterator<T, N, M, V, Size, std::random_access_iterator_tag>::difference_type
1642 const Iterator<T, N, M, V, Size, std::random_access_iterator_tag> &i)
1657 template <
typename T,
size_t N,
typename MT>
1658 struct ReplaceTypes<T, N, MT, Category::ForwardIterator>
1660 using type = IteratorDetails::Iterator<T, N>;
1662 template <
typename T,
size_t N,
typename MT>
1663 struct ReplaceTypes<T, N, MT, Category::BidirectionalIterator>
1665 using type = IteratorDetails::Iterator<T, N>;
1667 template <
typename T,
size_t N,
typename MT>
1668 struct ReplaceTypes<T, N, MT, Category::RandomAccessIterator>
1670 using type = IteratorDetails::Iterator<T, N>;
1676 template <Vc::Operator Op,
typename S,
typename T, std::size_t N,
typename M,
typename U,
1678 Vc_INTRINSIC Vc::enable_if<(Offset >= determine_tuple_size_<S>::value && M::Size == N),
void>
1679 conditional_assign(Adapter<S, T, N> &,
const M &,
const U &)
1682 template <Vc::Operator Op,
typename S,
typename T, std::size_t N,
typename M,
typename U,
1683 std::size_t Offset = 0>
1684 Vc_INTRINSIC Vc::enable_if<(Offset < determine_tuple_size_<S>::value && M::Size == N),
void>
1685 conditional_assign(Adapter<S, T, N> &lhs,
const M &mask,
const U &rhs)
1687 using V =
typename std::decay<decltype(get_dispatcher<Offset>(lhs))>::type;
1688 using M2 =
typename V::mask_type;
1689 conditional_assign<Op>(get_dispatcher<Offset>(lhs), simd_cast<M2>(mask), get_dispatcher<Offset>(rhs));
1690 conditional_assign<Op, S, T, N, M, U, Offset + 1>(lhs, mask, rhs);
1692 template <Vc::Operator Op,
typename S,
typename T, std::size_t N,
typename M,
1694 Vc_INTRINSIC Vc::enable_if<(Offset >= determine_tuple_size_<S>::value && M::Size == N),
void>
1695 conditional_assign(Adapter<S, T, N> &,
const M &)
1698 template <Vc::Operator Op,
typename S,
typename T, std::size_t N,
typename M,
1699 std::size_t Offset = 0>
1700 Vc_INTRINSIC Vc::enable_if<(Offset < determine_tuple_size_<S>::value && M::Size == N),
void>
1701 conditional_assign(Adapter<S, T, N> &lhs,
const M &mask)
1703 using V =
typename std::decay<decltype(get_dispatcher<Offset>(lhs))>::type;
1704 using M2 =
typename V::mask_type;
1705 conditional_assign<Op>(get_dispatcher<Offset>(lhs), simd_cast<M2>(mask));
1706 conditional_assign<Op, S, T, N, M, Offset + 1>(lhs, mask);
1730 template <
typename T,
size_t N = 0,
typename MT =
void>
1752 #define Vc_SIMDIZE_INTERFACE(MEMBERS_) \ 1753 template <std::size_t N_> \ 1754 inline auto vc_get_()->decltype(std::get<N_>(std::tie MEMBERS_)) \ 1756 return std::get<N_>(std::tie MEMBERS_); \ 1758 template <std::size_t N_> \ 1759 inline auto vc_get_() const->decltype(std::get<N_>(std::tie MEMBERS_)) \ 1761 return std::get<N_>(std::tie MEMBERS_); \ 1763 enum : std::size_t { \ 1764 tuple_size = std::tuple_size<decltype(std::make_tuple MEMBERS_)>::value \ 1771 using Vc::SimdizeDetail::swap;
1774 #endif // VC_COMMON_SIMDIZE_H_ void free(T *p)
Frees memory that was allocated with Vc::malloc.
bool operator<(const Iterator &rhs) const
Returns whether all entries accessed via iterator dereferencing come before the iterator rhs...
result_vector_type< L, R > operator-(L &&lhs, R &&rhs)
Applies - component-wise and concurrently.
result_vector_type< L, R > operator*(L &&lhs, R &&rhs)
Applies * component-wise and concurrently.
SimdizeDetail::simdize< T, N, MT > simdize
Iterator operator--(int)
Postfix overload of the above.
S extract(const Adapter< S, T, N > &a, size_t i)
Extracts and returns one scalar object from a SIMD slot at offset i in the simdized object a...
An allocator that uses global new and supports over-aligned types, as per [C++11 20.6.9].
result_vector_type< L, R > operator+(L &&lhs, R &&rhs)
Applies + component-wise and concurrently.
void assign(Adapter< S, T, N > &a, size_t i, const S &x)
Assigns one scalar object x to a SIMD slot at offset i in the simdized object a.
Iterator & operator--()
Advances the iterator by one vector width, or respectively N scalar steps.
Adapter< S, T, N > shifted(const Adapter< S, T, N > &a, int shift)
Returns a new vectorized object where each entry is shifted by shift.
Vector Classes Namespace.
This is the iterator type created when applying simdize to a bidirectional iterator type...