ssmkit  master-68aed98
base_process.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <algorithm>
4 #include <vector>
5 
6 namespace ssmkit {
7 namespace process {
8 
9 template <typename TProcess>
10 class BaseProcess {
11  public:
12  template <typename... TArgs>
13  decltype(auto) random_n(const size_t &n, const TArgs &... args) {
14  std::vector<decltype(static_cast<TProcess *>(this)->random(args...))>
15  output(n);
16  std::generate_n(output.begin(), n, [this, &args...]() {
17  return static_cast<TProcess *>(this)->random(args...);
18  });
19  return output;
20  }
21 };
22 
23 } // namespace process
24 } // namespace ssmkit
decltype(auto) random_n(const size_t &n, const TArgs &...args)