Batch of constants

template<class batch_type, typename batch_type::value_type... Values>
struct batch_constant

batch of integral constants

Abstract representation of a batch of integral constants.

Template Parameters:
  • batch_type – the type of the associated batch values.

  • Values – constants represented by this batch

Public Functions

inline operator batch_type() const noexcept

Generate a batch of batch_type from this batch_constant.

inline constexpr value_type get(size_t i) const noexcept

Get the i th element of this batch_constant.

template<class batch_type, class G>
inline constexpr auto xsimd::make_batch_constant() noexcept -> decltype(detail::make_batch_constant<batch_type, G>(detail::make_index_sequence<batch_type::size>()))

Build a batch_constant out of a generator function.

The following generator produces a batch of (n - 1, 0, 1, ... n-2)

struct Rot
{
    static constexpr unsigned get(unsigned i, unsigned n)
    {
        return (i + n - 1) % n;
    }
};
Template Parameters:
  • batch_type – type of the (non-constant) batch to build

  • G – type used to generate that batch. That type must have a static member get that’s used to generate the batch constant. Conversely, the generated batch_constant has value {G::get(0, batch_size), ... , G::get(batch_size - 1, batch_size)}