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 
4 #include <functional>
5 #include <type_traits>
6 
7 ////////////////////////////////////////////////////////////////////////
8 // makeWatchFunc
9 //
10 // Construct the correct lambda to allow general registration of
11 // pointer-to-member callback functions for global and local signals.
12 namespace art {
13  namespace detail {
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 }
33 #endif /* art_Framework_Services_Registry_detail_makeWatchFunc_h */
34 
35 // Local Variables:
36 // mode: c++
37 // End:
std::function< ResultType(Args...)> makeWatchFunc(ResultType(T::*slot)(Args...), T &t)
Definition: makeWatchFunc.h:16
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
double T
Definition: Xdiff_gwt.C:5