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 {
12 std::vector<std::function<return_type(arg_types...)> > functors;
13 std::vector<std::string> keys;
14 std::vector<std::string> titles;
15 template <typename functor_type> void add(const functor_type& functor, const std::string& key, const std::string& title="")
16 {
17 functors.push_back(functor);
18 keys.push_back(key);
19 titles.push_back(title);
20 }
21 std::vector<return_type> operator()( arg_types... arg ) const
22 {
23 std::vector<return_type> rt;
24 for( auto& f : functors ) rt.push_back( f(arg...) );
25 return rt;
26 }
27 };
28
29}
30
31#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="")