Wayverb
callback_accumulator.h
1 #pragma once
2 
3 #include "utilities/aligned/vector.h"
4 
5 namespace wayverb {
6 namespace core {
7 
8 template <typename T, typename Ret = typename T::return_type>
9 class callback_accumulator final {
10 public:
12  : postprocessor_{std::move(t)} {}
13 
14  template <typename... Ts>
15  callback_accumulator(Ts&&... ts)
16  : postprocessor_{std::forward<Ts>(ts)...} {}
17 
18  template <typename... Ts>
19  void operator()(Ts&&... ts) {
20  output_.emplace_back(postprocessor_(std::forward<Ts>(ts)...));
21  }
22 
23  const auto& get_output() const { return output_; }
24 
25 private:
26  util::aligned::vector<Ret> output_;
27  T postprocessor_;
28 };
29 
30 template <typename T>
31 auto make_callback_accumulator(T t) {
32  return callback_accumulator<T>{std::move(t)};
33 }
34 
35 } // namespace core
36 } // namespace wayverb
Definition: traits.cpp:2
Definition: capsule_base.h:9
Definition: callback_accumulator.h:9