Template Function otyca::get_value_map

Function Documentation

template<typename K, typename V, typename O>
std::map<K, V> otyca::get_value_map(const std::vector<std::shared_ptr<O>> &objs, const ObjectGetter<K, O> &key_getter, const ObjectGetter<V, O> &val_getter)

Creates a map from a vector of shared pointers based on key and value getters.

Template Parameters:
  • K – Key type of the map.

  • V – Value type of the map.

  • O – Object type stored in the shared pointers.

Parameters:
  • objs – Vector of shared pointers to objects.

  • key_getter – Function to extract keys.

  • val_getter – Function to extract values.

Returns:

std::map<K, V> A map with extracted keys and values.