Interface Documentation
Version: invalid
function_traits.hh
Go to the documentation of this file.
1 /*
2  @@@@@@@@ @@ @@@@@@ @@@@@@@@ @@
3  /@@///// /@@ @@////@@ @@////// /@@
4  /@@ /@@ @@@@@ @@ // /@@ /@@
5  /@@@@@@@ /@@ @@///@@/@@ /@@@@@@@@@/@@
6  /@@//// /@@/@@@@@@@/@@ ////////@@/@@
7  /@@ /@@/@@//// //@@ @@ /@@/@@
8  /@@ @@@//@@@@@@ //@@@@@@ @@@@@@@@ /@@
9  // /// ////// ////// //////// //
10 
11  Copyright (c) 2016, Triad National Security, LLC
12  All rights reserved.
13  */
14 #pragma once
15 
18 #if !defined(__FLECSI_PRIVATE__)
19 #error Do not include this file directly!
20 #endif
21 
22 #include <functional>
23 #include <tuple>
24 
25 namespace flecsi {
26 namespace util {
27 
28 template<typename T>
29 struct function_traits : function_traits<decltype(&T::operator())> {};
30 
31 template<typename R, typename... As>
32 struct function_traits<R(As...)> {
33  using return_type = R;
34  using arguments_type = std::tuple<As...>;
35 };
36 
37 template<typename R, typename... As>
38 struct function_traits<R (*)(As...)> : public function_traits<R(As...)> {};
39 
40 template<typename C, typename R, typename... As>
41 struct function_traits<R (C::*)(As...)> : public function_traits<R(As...)> {
42  using owner_type = C;
43 };
44 
45 template<typename C, typename R, typename... As>
46 struct function_traits<R (C::*)(As...) const>
47  : function_traits<R (C::*)(As...)> {};
48 
49 template<typename C, typename R, typename... As>
50 struct function_traits<R (C::*)(As...) volatile>
51  : function_traits<R (C::*)(As...)> {};
52 
53 template<typename C, typename R, typename... As>
54 struct function_traits<R (C::*)(As...) const volatile>
55  : function_traits<R (C::*)(As...)> {};
56 
57 template<typename R, typename... As>
58 struct function_traits<std::function<R(As...)>>
59  : public function_traits<R(As...)> {};
60 
61 template<typename T>
62 struct function_traits<T &> : public function_traits<T> {};
63 template<typename T>
64 struct function_traits<T &&> : public function_traits<T> {};
65 template<typename T>
66 struct function_traits<const T> : function_traits<T> {};
67 template<typename T>
68 struct function_traits<volatile T> : function_traits<T> {};
69 template<typename T>
70 struct function_traits<const volatile T> : function_traits<T> {};
71 
72 } // namespace util
73 } // namespace flecsi
Definition: function_traits.hh:29
Definition: control.hh:31