Skip to content

Commit 7563779

Browse files
committed
feat: more call traits
1 parent 00f2592 commit 7563779

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

include/boost/capy/detail/call_traits.hpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,39 @@ namespace boost {
1717
namespace capy {
1818
namespace detail {
1919

20+
// type_list
21+
2022
template<class... Ts> struct type_list {};
2123

24+
// type_at
25+
26+
template<std::size_t N, class List>
27+
struct type_at;
28+
29+
template<std::size_t N, class Head, class... Tail>
30+
struct type_at<N, type_list<Head, Tail...>>
31+
: type_at<N - 1, type_list<Tail...>>
32+
{
33+
};
34+
35+
template<class Head, class... Tail>
36+
struct type_at<0, type_list<Head, Tail...>>
37+
{
38+
using type = Head;
39+
};
40+
41+
// type_list_size
42+
43+
template<class List>
44+
struct type_list_size;
45+
46+
template<class... Ts>
47+
struct type_list_size<type_list<Ts...>>
48+
: std::integral_constant<std::size_t, sizeof...(Ts)>
49+
{
50+
};
51+
// call_traits
52+
2253
template<class T, class = void>
2354
struct call_traits : std::false_type
2455
{
@@ -62,6 +93,8 @@ struct call_traits<F, typename std::enable_if<
6293
{
6394
};
6495

96+
// is_invocable
97+
6598
template<class T, class R, class ArgList, class = void>
6699
struct is_invocable_impl : std::false_type {};
67100

0 commit comments

Comments
 (0)