|
||||
File indexing completed on 2025-01-18 09:29:45
0001 /* 0002 0003 @Copyright Barrett Adair 2015-2017 0004 Distributed under the Boost Software License, Version 1.0. 0005 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 0006 0007 */ 0008 0009 #ifndef BOOST_CLBL_TRTS_APPLY_RETURN_HPP 0010 #define BOOST_CLBL_TRTS_APPLY_RETURN_HPP 0011 0012 #include <boost/callable_traits/detail/core.hpp> 0013 0014 namespace boost { namespace callable_traits { 0015 0016 BOOST_CLBL_TRTS_DEFINE_SFINAE_ERROR_ORIGIN(apply_return) 0017 BOOST_CLBL_TRTS_SFINAE_MSG(apply_return, invalid_types_for_apply_return) 0018 0019 namespace detail { 0020 0021 template<typename T, typename R> 0022 struct apply_return_helper { 0023 using type = typename detail::traits<T>::template apply_return<R>; 0024 }; 0025 0026 //special case 0027 template<typename... Args, typename R> 0028 struct apply_return_helper<std::tuple<Args...>, R> { 0029 using type = R(Args...); 0030 }; 0031 } 0032 0033 //[ apply_return_hpp 0034 /*` 0035 [section:ref_apply_return apply_return] 0036 [heading Header] 0037 ``#include <boost/callable_traits/apply_return.hpp>`` 0038 [heading Definition] 0039 */ 0040 0041 template<typename T, typename R> 0042 using apply_return_t = //see below 0043 //<- 0044 detail::try_but_fail_if_invalid< 0045 typename detail::apply_return_helper<T, R>::type, 0046 invalid_types_for_apply_return>; 0047 0048 namespace detail { 0049 0050 template<typename T, typename R, typename = std::false_type> 0051 struct apply_return_impl {}; 0052 0053 template<typename T, typename R> 0054 struct apply_return_impl <T, R, typename std::is_same< 0055 apply_return_t<T, R>, detail::dummy>::type> 0056 { 0057 using type = apply_return_t<T, R>; 0058 }; 0059 } 0060 //-> 0061 0062 template<typename T, typename R> 0063 struct apply_return : detail::apply_return_impl<T, R> {}; 0064 0065 //<- 0066 }} // namespace boost::callable_traits 0067 //-> 0068 0069 /*` 0070 [heading Constraints] 0071 * `T` must one of the following: 0072 * `std::tuple` template instantiation 0073 * function 0074 * function pointer 0075 * function reference 0076 * member function pointer 0077 * member data pointer 0078 * If `T` is a pointer, it may not be cv/ref qualified 0079 0080 [heading Behavior] 0081 * When `T` is `std::tuple<Args...>`, the aliased type is `R(Args...)`. 0082 * When `T` is a function, function pointer, function reference, or member function pointer, the aliased type's return type is `R`, but is otherwise identical to `T`. 0083 * When `T` is a member data pointer of class `foo` to a `U` type (such that `T` is `U foo::*`), the aliased type is `R foo::*`. 0084 0085 [heading Input/Output Examples] 0086 [table 0087 [[`T`] [`apply_return_t<T, float>`]] 0088 [[`std::tuple<int, int>`] [`float(int, int)`]] 0089 [[`int()`] [`float()`]] 0090 [[`int (&)()`] [`float(&)()`]] 0091 [[`int (*)()`] [`float(*)()`]] 0092 [[`int (*)(...)`] [`float(*)()`]] 0093 [[`int(foo::*)()`] [`float(foo::*)()`]] 0094 [[`int(foo::*)() &`] [`float(foo::*)() &`]] 0095 [[`int(foo::*)() &&`] [`float(foo::*)() &&`]] 0096 [[`int(foo::*)() const`] [`float(foo::*)() const`]] 0097 [[`int(foo::*)() transaction_safe`] [`float(foo::*)() transaction_safe`]] 0098 [[`int foo::*`] [`float foo::*`]] 0099 [[`int`] [(substitution failure)]] 0100 [[`int (*const)()`] [(substitution failure)]] 0101 ] 0102 0103 [heading Example Program] 0104 [/import ../example/apply_return.cpp] 0105 [apply_return] 0106 [endsect] 0107 */ 0108 //] 0109 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |