Template Function otyca::get_value_array

Function Documentation

template<typename T, typename O>
std::vector<T> otyca::get_value_array(const std::vector<std::shared_ptr<O>> &objs, const ObjectGetter<T, O> &getter)

Retrieves a vector of values obtained by applying a getter function to a vector of objects.

This function iterates over a vector of shared pointers to objects and applies the provided getter function to each object to retrieve its corresponding value. It returns a vector of the retrieved values.

Template Parameters:
  • T – The type of values to be retrieved by the getter function.

  • O – The type of the objects in the input vector.

Parameters:
  • objs – A vector of shared pointers to objects from which the values will be extracted.

  • getter – A function that extracts a value of type T from each object of type O.

Returns:

A vector of values of type T, each obtained by applying the getter function to the corresponding object.