]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/callable_traits/return_type.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / callable_traits / return_type.hpp
1 /*
2
3 @Copyright Barrett Adair 2015-2017
4
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
7
8 */
9
10 #ifndef BOOST_CLBL_TRTS_RESULT_OF_HPP
11 #define BOOST_CLBL_TRTS_RESULT_OF_HPP
12
13 #include <boost/callable_traits/detail/core.hpp>
14
15 namespace boost { namespace callable_traits {
16
17 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(return_type)
18 BOOST_CLBL_TRTS_SFINAE_MSG(return_type, unable_to_determine_return_type)
19
20 //[ return_type_hpp
21 /*`
22 [section:ref_return_type return_type]
23 [heading Header]
24 ``#include <boost/callable_traits/return_type.hpp>``
25 [heading Definition]
26 */
27
28 template<typename T>
29 using return_type_t = //see below
30 //<-
31 detail::try_but_fail_if_invalid<
32 typename detail::traits<detail::shallow_decay<T>>::return_type,
33 unable_to_determine_return_type>;
34
35 namespace detail {
36
37 template<typename T, typename = std::false_type>
38 struct return_type_impl {};
39
40 template<typename T>
41 struct return_type_impl <T, typename std::is_same<
42 return_type_t<T>, detail::dummy>::type>
43 {
44 using type = return_type_t<T>;
45 };
46 }
47
48 //->
49
50 template<typename T>
51 struct return_type : detail::return_type_impl<T> {};
52
53 //<-
54 }} // namespace boost::callable_traits
55 //->
56
57 /*`
58 [heading Constraints]
59 * `T` must be one of the following:
60 * function
61 * function pointer
62 * function reference
63 * member function pointer
64 * member data pointer
65 * user-defined type with a non-overloaded `operator()`
66 * type of a non-generic lambda
67
68 [heading Behavior]
69 * When the constraints are violated, a substitution failure occurs.
70 * The aliased type is the return type of `T`.
71
72 [heading Input/Output Examples]
73 [table
74 [[`T`] [`return_type_t<T, std::tuple>`]]
75 [[`void()`] [`void`]]
76 [[`float(*)()`] [`float`]]
77 [[`const char*(&)()`] [`const char *`]]
78 [[`int(foo::*)() const`] [`int`]]
79 [[`int`] [(substitution failure)]]
80 [[`int (*const)()`] [(substitution failure)]]
81 ]
82
83 [heading Example Program]
84 [import ../example/return_type.cpp]
85 [return_type]
86 [endsect]
87 */
88 //]
89
90 #endif // #ifndef BOOST_CLBL_TRTS_RESULT_OF_HPP