AmpGen 2.1
Loading...
Searching...
No Matches
KeyedFunctors.h
Go to the documentation of this file.
1#ifndef AMPGEN_LITESPAN_H
2#define AMPGEN_LITESPAN_H
3
4#include "AmpGen/MsgService.h"
5#include "AmpGen/Utilities.h"
6
7namespace AmpGen {
8 template <typename return_type, typename... arg_types> struct KeyedFunctors;
9
10 template <typename return_type, typename... arg_types> struct KeyedFunctors<return_type(arg_types...)> {
11 std::vector<std::function<return_type(arg_types...)>> functors;
12 std::vector<std::string> keys;
13 std::vector<std::string> titles;
14 template <typename functor_type> void add(const functor_type &functor, const std::string &key, const std::string &title = "") {
15 functors.push_back(functor);
16 keys.push_back(key);
17 titles.push_back(title);
18 }
19 std::vector<return_type> operator()(arg_types... arg) const {
20 std::vector<return_type> rt;
21 for(auto &f : functors) rt.push_back(f(arg...));
22 return rt;
23 }
24 };
25
26}
27
28#endif
std::vector< std::function< return_type(arg_types...)> > functors
std::vector< return_type > operator()(arg_types... arg) const
void add(const functor_type &functor, const std::string &key, const std::string &title="")