function_meta.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------
2 // Nano RPC
3 // https://github.com/tdv/nanorpc
4 // Created: 05.2018
5 // Copyright (C) 2018 tdv
6 //-------------------------------------------------------------------
7 
8 #ifndef __NANO_RPC_CORE_DETAIL_FUNCTION_META_H__
9 #define __NANO_RPC_CORE_DETAIL_FUNCTION_META_H__
10 
11 // STD
12 #include <functional>
13 #include <tuple>
14 #include <type_traits>
15 
17 {
18 
19 template <typename>
21 
22 template <typename R, typename ... T>
23 struct function_meta<std::function<R (T ... )>>
24 {
25  using return_type = std::decay_t<R>;
26  using arguments_tuple_type = std::tuple<std::decay_t<T> ... >;
27 };
28 
29 template<typename T>
31 {
32  using type = void;
33 };
34 
35 template<typename Ret, typename Class, typename... Args>
36 struct memfun_type<Ret(Class::*)(Args...) const>
37 {
38  using type = std::function<Ret(Args...)>;
39 };
40 
41 template<typename F>
42 typename memfun_type<decltype(&F::operator())>::type
43 lambdaToFunction(F const &func)
44 { // Function from lambda !
45  return func;
46 }
47 
48 
49 } // namespace nanorpc::core::detail
50 
51 
52 #endif // !__NANO_RPC_CORE_DETAIL_FUNCTION_META_H__
nanorpc::core::detail::memfun_type::type
void type
Definition: function_meta.h:32
nanorpc::core::detail::function_meta< std::function< R(T ...)> >::arguments_tuple_type
std::tuple< std::decay_t< T > ... > arguments_tuple_type
Definition: function_meta.h:26
nanorpc::core::detail
Definition: function_meta.h:16
nanorpc::core::detail::function_meta
Definition: function_meta.h:20
nanorpc::core::detail::lambdaToFunction
memfun_type< decltype(&F::operator())>::type lambdaToFunction(F const &func)
Definition: function_meta.h:43
nanorpc::core::detail::function_meta< std::function< R(T ...)> >::return_type
std::decay_t< R > return_type
Definition: function_meta.h:25
nanorpc::core::detail::pack::meta::type
type
Definition: pack_meta.h:26
nanorpc::core::detail::memfun_type
Definition: function_meta.h:30
nanorpc::core::detail::memfun_type< Ret(Class::*)(Args...) const >::type
std::function< Ret(Args...)> type
Definition: function_meta.h:38
std
Definition: Node.hpp:366


depthai
Author(s): Martin Peterlin
autogenerated on Sat Mar 22 2025 02:58:19