Turi Create
4.0
tuple.hpp
1
/* Copyright © 2017 Apple Inc. All rights reserved.
2
*
3
* Use of this source code is governed by a BSD-3-clause license that can
4
* be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5
*/
6
#ifndef CPPIPC_UTIL_GENERICS_TUPLE_HPP
7
#define CPPIPC_UTIL_GENERICS_TUPLE_HPP
8
#include <tuple>
9
namespace
cppipc
{
10
11
namespace
tuple_detail {
12
template
<
typename
R,
typename
... T>
13
std::tuple<T...> __function_args_to_tuple(R (*)(T...)) {
14
return
std::tuple<T...>();
15
}
16
}
// namespace detail
17
18
19
/**
20
* \ingroup cppipc
21
* Converts the arguments of a function type to a tuple over the argument type.
22
*/
23
template
<
typename
Fn>
24
struct
function_args_to_tuple
{
25
typedef
decltype(tuple_detail::__function_args_to_tuple(reinterpret_cast<Fn*>(NULL))) type;
26
};
27
28
29
template
<
typename
T>
30
struct
left_shift_tuple {
31
typedef
std::tuple<> type;
32
};
33
34
35
36
/**
37
* \ingroup cppipc
38
* Returns a tuple without the left most element of the tuple.
39
* left shifting of an empty tuple returns an empty tuple.
40
*/
41
template
<
typename
T,
typename
... Ts>
42
struct
left_shift_tuple <
std
::tuple<T, Ts...> > {
43
typedef
std::tuple<Ts...> type;
44
};
45
46
}
// namespace cppipc
47
#endif
cppipc
Definition:
comm_client.hpp:28
cppipc::function_args_to_tuple
Definition:
tuple.hpp:24
std
STL namespace.
core
system
cppipc
util
generics
tuple.hpp
Generated by
1.8.13