3 @Copyright Barrett Adair 2015-2017
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)
10 #ifndef BOOST_CLBL_TRTS_RESULT_OF_HPP
11 #define BOOST_CLBL_TRTS_RESULT_OF_HPP
13 #include <boost/callable_traits/detail/core.hpp>
15 namespace boost { namespace callable_traits {
17 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(return_type)
18 BOOST_CLBL_TRTS_SFINAE_MSG(return_type, unable_to_determine_return_type)
22 [section:ref_return_type return_type]
24 ``#include <boost/callable_traits/return_type.hpp>``
29 using return_type_t = //see below
31 detail::try_but_fail_if_invalid<
32 typename detail::traits<detail::shallow_decay<T>>::return_type,
33 unable_to_determine_return_type>;
37 template<typename T, typename = std::false_type>
38 struct return_type_impl {};
41 struct return_type_impl <T, typename std::is_same<
42 return_type_t<T>, detail::dummy>::type>
44 using type = return_type_t<T>;
51 struct return_type : detail::return_type_impl<T> {};
54 }} // namespace boost::callable_traits
59 * `T` must be one of the following:
63 * member function pointer
65 * user-defined type with a non-overloaded `operator()`
66 * type of a non-generic lambda
69 * When the constraints are violated, a substitution failure occurs.
70 * The aliased type is the return type of `T`.
72 [heading Input/Output Examples]
74 [[`T`] [`return_type_t<T>`]]
76 [[`float(*)()`] [`float`]]
77 [[`const char*(&)()`] [`const char *`]]
78 [[`int(foo::*)() const`] [`int`]]
79 [[`int`] [(substitution failure)]]
80 [[`int (*const)()`] [(substitution failure)]]
83 [heading Example Program]
84 [import ../example/return_type.cpp]
90 #endif // #ifndef BOOST_CLBL_TRTS_RESULT_OF_HPP