delegates.h
Go to the documentation of this file.
1 #ifndef SOCKETCAN_INTERFACE_DELEGATES_H_
2 #define SOCKETCAN_INTERFACE_DELEGATES_H_
3 
4 #include <functional>
5 
6 namespace can
7 {
8 
9 template <typename T> class DelegateHelper : public T {
10 public:
11  template <typename Object, typename Instance, typename ...Args>
12  DelegateHelper(Object &&o, typename T::result_type (Instance::*member)(Args... args)) :
13  T([o, member](Args... args) -> typename T::result_type { return ((*o).*member)(args...); })
14  {
15  }
16  template <typename Callable>
17  DelegateHelper(Callable &&c) : T(c)
18  {
19  }
20 };
21 
22 } // namespace can
23 
24 #endif // SOCKETCAN_INTERFACE_DELEGATES_H_
can::DelegateHelper::DelegateHelper
DelegateHelper(Object &&o, typename T::result_type(Instance::*member)(Args... args))
Definition: delegates.h:12
can::DelegateHelper
Definition: delegates.h:9
can::DelegateHelper::DelegateHelper
DelegateHelper(Callable &&c)
Definition: delegates.h:17
can
Definition: asio_base.h:11


socketcan_interface
Author(s): Mathias Lüdtke
autogenerated on Wed Mar 2 2022 00:52:25