TermOx
memfn_signature.hpp
1 #ifndef TERMOX_WIDGET_DETAIL_MEMFN_SIGNATURE_HPP
2 #define TERMOX_WIDGET_DETAIL_MEMFN_SIGNATURE_HPP
3 namespace ox::detail {
4 
5 // Could be moved into Signals library with a deduction guide for Slot.
6 
8 template <typename>
9 struct MemFn_signature {};
10 
11 template <typename R, typename T, bool N, typename... Args>
12 struct MemFn_signature<R (T::*)(Args...) noexcept(N)> {
13  using type = R(Args...);
14 };
15 
16 template <typename R, typename T, bool N, typename... Args>
17 struct MemFn_signature<R (T::*)(Args...)& noexcept(N)> {
18  using type = R(Args...);
19 };
20 
21 template <typename R, typename T, bool N, typename... Args>
22 struct MemFn_signature<R (T::*)(Args...) const noexcept(N)> {
23  using type = R(Args...);
24 };
25 
26 template <typename R, typename T, bool N, typename... Args>
27 struct MemFn_signature<R (T::*)(Args...) const& noexcept(N)> {
28  using type = R(Args...);
29 };
30 
32 template <typename F>
33 using Call_signature_t =
34  typename MemFn_signature<decltype(&F::operator())>::type;
35 
36 } // namespace ox::detail
37 #endif // TERMOX_WIDGET_DETAIL_MEMFN_SIGNATURE_HPP
Deduce a function's signature type.
Definition: memfn_signature.hpp:9