Template Function otyca::prepend_value_to_array_vector

Function Documentation

template<typename T, std::size_t N>
std::vector<std::array<T, N + 1>> otyca::prepend_value_to_array_vector(const T &prepend_value, const std::vector<std::array<T, N>> &input)

Prepends a value to each array in a vector of fixed-size arrays.

This function takes a scalar value and a vector of arrays of size N, and returns a new vector of arrays of size N+1 where the first element of each array is the given value, and the remaining elements are copied from the original array.

Note

The function preserves the order of the input vector and performs a deep copy of all elements.

Template Parameters:
  • T – The type of the array elements.

  • N – The size of the input arrays.

Parameters:
  • prepend_value – The value to prepend to each array.

  • input – A vector of arrays of size N.

Returns:

A vector of arrays of size N+1, each starting with prepend_value followed by the elements of the corresponding input array.