36 constexpr TypeMarker() =
default;
42constexpr size_t get_arity()
44 return get_arity(TypeMarker<std::decay_t<T>>{});
50constexpr size_t get_arity(
const T &)
52 return get_arity<T>();
56template<
typename Return,
typename... Arguments>
57constexpr size_t get_arity(TypeMarker<Return (*)(Arguments...)>)
59 return sizeof...(Arguments);
62template<
typename Return,
typename... Arguments>
63constexpr size_t get_arity(TypeMarker<Return (*)(Arguments...)
noexcept>)
65 return sizeof...(Arguments);
71constexpr size_t get_arity(TypeMarker<T>)
73 return get_arity(TypeMarker<
decltype(&T::operator())>{}) - 1;
78#define KDBINDINGS_DEFINE_MEMBER_GET_ARITY(MODIFIERS) \
79 template<typename Return, typename Class, typename... Arguments> \
80 constexpr size_t get_arity(::KDBindings::Private::TypeMarker<Return (Class::*)(Arguments...) MODIFIERS>) \
82 return sizeof...(Arguments) + 1; \
87template<
typename Return,
typename Class,
typename... Arguments>
88constexpr size_t get_arity(::KDBindings::Private::TypeMarker<Return (Class::*)(Arguments...)>)
90 return sizeof...(Arguments) + 1;
130template<
typename Func,
typename... Args, std::size_t... Is>
131auto bind_first_helper(std::index_sequence<Is...>, Func &&fun, Args... args)
133 return std::bind(std::forward<Func>(fun), std::forward<Args>(args)..., placeholder<Is + 1>{}...);
151 typename = std::enable_if_t<std::conjunction_v<std::negation<std::is_placeholder<Args>>...>>>
152auto bind_first(Func &&fun, Args &&...args)
154 return bind_first_helper(std::make_index_sequence<get_arity<Func>() -
sizeof...(Args)>{}, std::forward<Func>(fun), std::forward<Args>(args)...);
165struct is_placeholder<
KDBindings::Private::placeholder<N>>
166 : integral_constant<int, N> {
The main namespace of the KDBindings library.
#define KDBINDINGS_DEFINE_MEMBER_GET_ARITY(MODIFIERS)