Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
function_traits.hpp File Reference
#include <type_traits>
#include <tuple>
Include dependency graph for function_traits.hpp:

Go to the source code of this file.

Classes

struct  sysio::vm::freestanding
 
struct  sysio::vm::detail::overloaded< Ts >
 
struct  sysio::vm::detail::wrapper_t< T >
 
struct  sysio::vm::detail::pack_from< Sz, N, I, Arg, Args... >
 
struct  sysio::vm::detail::pack_from< Sz, N, N, Arg, Args... >
 

Namespaces

namespace  sysio
 
namespace  sysio::vm
 
namespace  sysio::vm::detail
 

Macros

#define SYS_VM_HAS_MEMBER(ARG, NAME)
 
#define SYS_VM_HAS_MEMBER_TY(TY, NAME)
 
#define SYS_VM_HAS_TEMPLATE_MEMBER(ARG, NAME)
 
#define SYS_VM_HAS_TEMPLATE_MEMBER_TY(TY, NAME)
 
#define AUTO_PARAM_WORKAROUND(X)
 

Typedefs

template<bool Decay, typename F >
using sysio::vm::detail::get_types_t = decltype(get_types<Decay>(std::declval<F>()))
 
template<std::size_t N, typename... Args>
using sysio::vm::detail::pack_from_t = typename pack_from<sizeof...(Args), N, 0, Args...>::type
 
template<std::size_t N, typename F >
using sysio::vm::detail::parameters_from_impl_t = decltype(parameters_from_impl<N>(std::declval<F>()))
 
template<auto FN>
using sysio::vm::return_type_t = decltype(return_type(AUTO_PARAM_WORKAROUND(FN)))
 
template<auto FN>
using sysio::vm::class_from_member_t = decltype(class_from_member(AUTO_PARAM_WORKAROUND(FN)))
 
template<auto FN>
using sysio::vm::flatten_parameters_t = decltype(flatten_parameters(AUTO_PARAM_WORKAROUND(FN)))
 
template<auto FN>
using sysio::vm::decayed_flatten_parameters_t = decltype(decayed_flatten_parameters(AUTO_PARAM_WORKAROUND(FN)))
 
template<std::size_t N, auto FN>
using sysio::vm::parameter_at_t = decltype(parameter_at<N>(AUTO_PARAM_WORKAROUND(FN)))
 
template<std::size_t N, auto FN>
using sysio::vm::parameters_from_t = decltype(parameters_from<N>(AUTO_PARAM_WORKAROUND(FN)))
 

Functions

template<typename T >
constexpr bool sysio::vm::detail::pass_type ()
 
template<typename >
constexpr bool sysio::vm::detail::is_callable_impl (...)
 
template<class... Ts>
 sysio::vm::detail::overloaded (Ts...) -> overloaded< Ts... >
 
template<typename T , typename U >
constexpr U && sysio::vm::detail::make_dependent (U &&u)
 
template<typename F >
constexpr bool sysio::vm::is_callable (F &&fn)
 
template<bool Decay, typename R , typename... Args>
constexpr auto sysio::vm::detail::get_types (R(Args...)) -> std::tuple< R, freestanding, std::tuple< std::conditional_t< Decay, std::decay_t< Args >, Args >... > >
 
template<bool Decay, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::get_types (R(Cls::*)(Args...)) -> std::tuple< R, Cls, std::tuple< std::conditional_t< Decay, std::decay_t< Args >, Args >... > >
 
template<bool Decay, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::get_types (R(Cls::*)(Args...)&) -> std::tuple< R, Cls, std::tuple< std::conditional_t< Decay, std::decay_t< Args >, Args >... > >
 
template<bool Decay, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::get_types (R(Cls::*)(Args...)&&) -> std::tuple< R, Cls, std::tuple< std::conditional_t< Decay, std::decay_t< Args >, Args >... > >
 
template<bool Decay, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::get_types (R(Cls::*)(Args...) const &) -> std::tuple< R, Cls, std::tuple< std::conditional_t< Decay, std::decay_t< Args >, Args >... > >
 
template<bool Decay, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::get_types (R(Cls::*)(Args...) const &&) -> std::tuple< R, Cls, std::tuple< std::conditional_t< Decay, std::decay_t< Args >, Args >... > >
 
template<bool Decay, typename F >
constexpr auto sysio::vm::detail::get_types (F &&fn)
 
template<std::size_t N, typename R , typename... Args>
constexpr auto sysio::vm::detail::parameters_from_impl (R(Args...)) -> pack_from_t< N, Args... >
 
template<std::size_t N, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::parameters_from_impl (R(Cls::*)(Args...)) -> pack_from_t< N, Args... >
 
template<std::size_t N, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::parameters_from_impl (R(Cls::*)(Args...)&) -> pack_from_t< N, Args... >
 
template<std::size_t N, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::parameters_from_impl (R(Cls::*)(Args...)&&) -> pack_from_t< N, Args... >
 
template<std::size_t N, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::parameters_from_impl (R(Cls::*)(Args...) const &) -> pack_from_t< N, Args... >
 
template<std::size_t N, typename R , typename Cls , typename... Args>
constexpr auto sysio::vm::detail::parameters_from_impl (R(Cls::*)(Args...) const &&) -> pack_from_t< N, Args... >
 
template<std::size_t N, typename F >
constexpr auto sysio::vm::detail::parameters_from_impl (F &&fn)
 
template<typename R , typename... Args>
constexpr bool sysio::vm::is_function (R(*)(Args...))
 
template<typename F >
constexpr bool sysio::vm::is_function (F &&)
 
template<typename R , typename Cls , typename... Args>
constexpr bool sysio::vm::is_member_function (R(Cls::*)(Args...))
 
template<typename R , typename Cls , typename... Args>
constexpr bool sysio::vm::is_member_function (R(Cls::*)(Args...)&)
 
template<typename R , typename Cls , typename... Args>
constexpr bool sysio::vm::is_member_function (R(Cls::*)(Args...)&&)
 
template<typename R , typename Cls , typename... Args>
constexpr bool sysio::vm::is_member_function (R(Cls::*)(Args...) const &)
 
template<typename R , typename Cls , typename... Args>
constexpr bool sysio::vm::is_member_function (R(Cls::*)(Args...) const &&)
 
template<typename F >
constexpr bool sysio::vm::is_member_function (F &&)
 
template<typename F >
constexpr bool sysio::vm::is_class (F &&)
 
template<typename F >
constexpr auto sysio::vm::return_type (F &&fn) -> std::tuple_element_t< 0, detail::get_types_t< false, F > >
 
template<typename F >
constexpr auto sysio::vm::class_from_member (F &&fn) -> std::tuple_element_t< 1, detail::get_types_t< false, F > >
 
template<typename F >
constexpr auto sysio::vm::flatten_parameters (F &&fn) -> std::tuple_element_t< 2, detail::get_types_t< false, F > >
 
template<typename F >
constexpr auto sysio::vm::decayed_flatten_parameters (F &&fn) -> std::tuple_element_t< 2, detail::get_types_t< true, F > >
 
template<std::size_t N, typename F >
constexpr auto sysio::vm::parameter_at (F &&fn) -> std::tuple_element_t< N, decltype(flatten_parameters(std::declval< F >()))>
 
template<std::size_t N, typename F >
constexpr auto sysio::vm::parameters_from (F &&fn) -> detail::parameters_from_impl_t< N, F >
 

Macro Definition Documentation

◆ AUTO_PARAM_WORKAROUND

#define AUTO_PARAM_WORKAROUND ( X)
Value:

Definition at line 46 of file function_traits.hpp.

◆ SYS_VM_HAS_MEMBER

#define SYS_VM_HAS_MEMBER ( ARG,
NAME )
Value:
[](auto&& f, std::enable_if_t<std::is_class_v<std::decay_t<decltype(f)>> && \
decltype(&std::decay_t<decltype(f)>::type::NAME)>(), int> = 0) constexpr { \
return true; \
}, [](...) constexpr { return false; } \
}(sysio::vm::detail::wrapper_t<decltype(ARG)>{})
constexpr bool pass_type()

Definition at line 5 of file function_traits.hpp.

5#define SYS_VM_HAS_MEMBER(ARG, NAME) \
6 sysio::vm::detail::overloaded { \
7 [](auto&& f, std::enable_if_t<std::is_class_v<std::decay_t<decltype(f)>> && \
8 sysio::vm::detail::pass_type< \
9 decltype(&std::decay_t<decltype(f)>::type::NAME)>(), int> = 0) constexpr { \
10 return true; \
11 }, [](...) constexpr { return false; } \
12 }(sysio::vm::detail::wrapper_t<decltype(ARG)>{})

◆ SYS_VM_HAS_MEMBER_TY

#define SYS_VM_HAS_MEMBER_TY ( TY,
NAME )
Value:
[](auto&& f, std::enable_if_t<std::is_class_v<TY> && \
decltype(&std::decay_t<decltype(f)>::type::NAME)>(), int> = 0) constexpr { \
return true; \
}, [](...) constexpr { return false; } \

Definition at line 14 of file function_traits.hpp.

14#define SYS_VM_HAS_MEMBER_TY(TY, NAME) \
15 sysio::vm::detail::overloaded { \
16 [](auto&& f, std::enable_if_t<std::is_class_v<TY> && \
17 sysio::vm::detail::pass_type< \
18 decltype(&std::decay_t<decltype(f)>::type::NAME)>(), int> = 0) constexpr { \
19 return true; \
20 }, [](...) constexpr { return false; } \
21 }(sysio::vm::detail::wrapper_t<TY>{})

◆ SYS_VM_HAS_TEMPLATE_MEMBER

#define SYS_VM_HAS_TEMPLATE_MEMBER ( ARG,
NAME )
Value:
[&](auto&& f, std::enable_if_t<std::is_class_v<std::decay_t<decltype(f)>> && \
decltype(&std::decay_t<decltype(f)>::type::template NAME)>(), int> = 0) constexpr { \
return true; \
}, [](...) constexpr { return false; } \
}(sysio::vm::detail::wrapper_t<decltype(ARG)>{})
#define NAME(s)

Definition at line 23 of file function_traits.hpp.

23#define SYS_VM_HAS_TEMPLATE_MEMBER(ARG, NAME) \
24 sysio::vm::detail::overloaded { \
25 [&](auto&& f, std::enable_if_t<std::is_class_v<std::decay_t<decltype(f)>> && \
26 sysio::vm::detail::pass_type< \
27 decltype(&std::decay_t<decltype(f)>::type::template NAME)>(), int> = 0) constexpr { \
28 return true; \
29 }, [](...) constexpr { return false; } \
30 }(sysio::vm::detail::wrapper_t<decltype(ARG)>{})

◆ SYS_VM_HAS_TEMPLATE_MEMBER_TY

#define SYS_VM_HAS_TEMPLATE_MEMBER_TY ( TY,
NAME )
Value:
[](auto&& f, std::enable_if_t<std::is_class_v<TY> && \
decltype(&std::decay_t<decltype(f)>::type::template NAME)>(), int> = 0) constexpr { \
return true; \
}, [](...) constexpr { return false; } \

Definition at line 32 of file function_traits.hpp.

32#define SYS_VM_HAS_TEMPLATE_MEMBER_TY(TY, NAME) \
33 sysio::vm::detail::overloaded { \
34 [](auto&& f, std::enable_if_t<std::is_class_v<TY> && \
35 sysio::vm::detail::pass_type< \
36 decltype(&std::decay_t<decltype(f)>::type::template NAME)>(), int> = 0) constexpr { \
37 return true; \
38 }, [](...) constexpr { return false; } \
39 }(sysio::vm::detail::wrapper_t<TY>{})