makeWatchFunc.h
Go to the documentation of this file.
1 #ifndef art_Framework_Services_Registry_detail_makeWatchFunc_h
2 #define art_Framework_Services_Registry_detail_makeWatchFunc_h
3 // vim: set sw=2 expandtab :
4 
5 #include <functional>
6 #include <type_traits>
7 
8 // Construct the correct lambda to allow general registration of
9 // pointer-to-member callback functions for global and local signals.
10 
11 namespace art {
12  namespace detail {
13 
14  template <typename T, typename ResultType, typename... Args>
15  std::function<ResultType(Args...)>
16  makeWatchFunc(ResultType (T::*slot)(Args...), T& t)
17  {
18  return [slot, &t](Args&&... args) -> ResultType {
19  return (t.*slot)(std::forward<Args>(args)...);
20  };
21  }
22 
23  template <typename T, typename ResultType, typename... Args>
24  std::function<ResultType(Args...)>
25  makeWatchFunc(ResultType (T::*slot)(Args...) const, T const& t)
26  {
27  return [slot, &t](Args&&... args) -> ResultType {
28  return (t.*slot)(std::forward<Args>(args)...);
29  };
30  }
31 
32  } // namespace detail
33 } // namespace art
34 
35 #endif /* art_Framework_Services_Registry_detail_makeWatchFunc_h */
36 
37 // Local Variables:
38 // mode: c++
39 // End:
std::function< ResultType(Args...)> makeWatchFunc(ResultType(T::*slot)(Args...), T &t)
Definition: makeWatchFunc.h:16
static QCString args
Definition: declinfo.cpp:674
void function(int client, int *resource, int parblock, int *test, int p)