Wayverb
map_to_vector.h
1 #pragma once
2 
3 #include "utilities/aligned/vector.h"
4 
5 #include <algorithm>
6 
7 namespace util {
8 
9 template <typename It, typename Callback>
10 auto map_to_vector(It b, It e, const Callback &callback) {
11  using ReturnType = std::decay_t<decltype(
12  std::declval<Callback>()(*std::declval<It>()))>;
13  aligned::vector<ReturnType> ret;
14  ret.reserve(std::distance(b, e));
15  std::transform(b, e, std::back_inserter(ret), callback);
16  return ret;
17 }
18 
19 } // namespace util
Definition: allocator.h:6