1 /*
2 
3 @Copyright Barrett Adair 2015-2017
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6 
7 */
8 
9 #ifndef BOOST_CLBL_TRTS_DETAIL_FUNCTION_OBJECT_HPP
10 #define BOOST_CLBL_TRTS_DETAIL_FUNCTION_OBJECT_HPP
11 
12 #include <boost/callable_traits/detail/pmf.hpp>
13 #include <boost/callable_traits/detail/default_callable_traits.hpp>
14 #include <boost/callable_traits/detail/forward_declarations.hpp>
15 #include <boost/callable_traits/detail/utility.hpp>
16 
17 namespace boost { namespace callable_traits { namespace detail {
18 
19 template<typename T, typename Base>
20 struct function_object : Base {
21 
22     using type = T;
23     using error_t = error_type<T>;
24     using function_type = typename Base::function_object_signature;
25     using arg_types = typename Base::non_invoke_arg_types;
26     using non_invoke_arg_types = arg_types;
27 
28     static constexpr const bool value = std::is_class<
29         typename std::remove_reference<T>::type>::value;
30 
31     using traits = function_object;
32     using class_type = error_t;
33     using invoke_type = error_t;
34     using remove_varargs = error_t;
35     using add_varargs = error_t;
36     using is_noexcept = typename Base::is_noexcept;
37     using add_noexcept = error_t;
38     using remove_noexcept = error_t;
39     using is_transaction_safe = typename Base::is_transaction_safe;
40     using add_transaction_safe = error_t;
41     using remove_transaction_safe = error_t;
42     using clear_args = error_t;
43 
44     template<template<class...> class Container>
45     using expand_args = typename function<function_type>::template
46         expand_args<Container>;
47 
48     template<template<class...> class Container, typename... RightArgs>
49     using expand_args_left = typename function<function_type>::template
50         expand_args_left<Container, RightArgs...>;
51 
52     template<template<class...> class Container, typename... LeftArgs>
53     using expand_args_right = typename function<function_type>::template
54         expand_args_right<Container, LeftArgs...>;
55 
56     template<typename C, typename U = T>
57     using apply_member_pointer =
58         typename std::remove_reference<U>::type C::*;
59 
60     template<typename>
61     using apply_return = error_t;
62 
63     template<typename...>
64     using push_front = error_t;
65 
66     template<typename...>
67     using push_back = error_t;
68 
69     template<std::size_t ElementCount>
70     using pop_args_front = error_t;
71 
72     template<std::size_t ElementCount>
73     using pop_args_back = error_t;
74 
75     template<std::size_t Index, typename... NewArgs>
76     using insert_args = error_t;
77 
78     template<std::size_t Index, std::size_t Count>
79     using remove_args = error_t;
80 
81     template<std::size_t Index, typename... NewArgs>
82     using replace_args = error_t;
83 
84     template<std::size_t Count>
85     using pop_front = error_t;
86 
87     template<std::size_t Count>
88     using pop_back = error_t;
89 
90     using remove_member_reference = error_t;
91     using add_member_lvalue_reference = error_t;
92     using add_member_rvalue_reference = error_t;
93     using add_member_const = error_t;
94     using add_member_volatile = error_t;
95     using add_member_cv = error_t;
96     using remove_member_const = error_t;
97     using remove_member_volatile = error_t;
98     using remove_member_cv = error_t;
99 };
100 
101 template<typename T, typename U, typename Base>
102 struct function_object <T U::*, Base>
103     : default_callable_traits<> {};
104 
105 }}} // namespace boost::callable_traits::detail
106 
107 #endif // #ifndef BOOST_CLBL_TRTS_DETAIL_FUNCTION_OBJECT_HPP
108