Skip to content

More versatile Vectortype<>

Florian Lemaitre requested to merge flemaitr_vectortype into master

More complete definition of Vectortype

Examples of what is now possible:

using VT = Vectortype<float, 4, Vc_tag>;

using t1 = typename VT::type; // -> Vc::Vector<float, Vc::VectorAbi::Sse>
using t2 = typename VT::int_::type; // -> Vc::Vector<int32_t, Vc::VectorAbi::Sse>
using t3 = typename VT::scalar_t; // -> float
using t4 = typename VT::int_::scalar_t; // -> int32_t

Vectortype has the following interface:

template <class T, size_t N, class Tag>
struct Vectortype {
  using type = /* a vector type containing N elements of type T from the library Tag */;
  using bool_t = /* a compatible vector type to handle conditions */;
  using booltype = bool_t; // backward compatibility
  using scalar_t = T;
  using int_   = Vectortype</* int      type with the same size as T */, N, Tag>;
  using uint_  = Vectortype</* unsigned type with the same size as T */, N, Tag>;
  using float_ = Vectortype</* float    type with the same size as T */, N, Tag>;
  static constexpr size_t cardinality = N;
};
Edited by Florian Lemaitre

Merge request reports