|
||||
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_FUNCTION_TYPE_HPP 0010 #define BOOST_CLBL_TRTS_FUNCTION_TYPE_HPP 0011 0012 #include <boost/callable_traits/detail/core.hpp> 0013 0014 namespace boost { namespace callable_traits { 0015 0016 //[ function_type_hpp 0017 /*`[section:ref_function_type function_type] 0018 [heading Header] 0019 ``#include <boost/callable_traits/function_type.hpp>`` 0020 [heading Definition] 0021 */ 0022 0023 template<typename T> 0024 using function_type_t = //see below 0025 //<- 0026 detail::try_but_fail_if_invalid<typename detail::traits< 0027 detail::shallow_decay<T>>::function_type, 0028 cannot_determine_parameters_for_this_type>; 0029 0030 namespace detail { 0031 0032 template<typename T, typename = std::false_type> 0033 struct function_type_impl {}; 0034 0035 template<typename T> 0036 struct function_type_impl <T, typename std::is_same< 0037 function_type_t<T>, detail::dummy>::type> 0038 { 0039 using type = function_type_t<T>; 0040 }; 0041 } 0042 0043 //-> 0044 0045 template<typename T> 0046 struct function_type : detail::function_type_impl<T> {}; 0047 0048 //<- 0049 }} // namespace boost::callable_traits 0050 //-> 0051 0052 /*` 0053 [heading Constraints] 0054 * `T` must be one of the following: 0055 * function 0056 * function pointer 0057 * function reference 0058 * member function pointer 0059 * member data pointer 0060 * user-defined type with a non-overloaded `operator()` 0061 * type of a non-generic lambda 0062 0063 [heading Behavior] 0064 * When the constraints are violated, a substitution failure occurs. 0065 * When `T` is a function, the aliased type is identical to `T`, except that the aliased function type will not have member qualifiers or the `transaction_safe` specifier. 0066 * When `T` is a function pointer, the aliased type is equivalent to `std::remove_pointer_t<T>`. 0067 * When `T` is a function reference, the aliased type is equivalent to `std::remove_reference_t<T>`. 0068 * When `T` is a function object, the aliased type is a function type with the same return type and parameter list as `T`'s `operator()`. 0069 * When `T` is a member function pointer, the aliased type is a function type with the same return type as `T`, and the first parameter is a reference to the parent class of `T`, qualified according to the member qualifiers on `T`. The subsequent parameters, if any, are the parameter types of `T`. 0070 * When `T` is a member data pointer, the aliased type is a function type returning the underlying member type of `T`, taking a single parameter, which is a `const` reference to the parent type of `T`. 0071 * In all cases, the aliased function type will not have member qualifiers, and will not have the `transaction_safe` specifier. 0072 0073 [heading Input/Output Examples] 0074 [table 0075 [[`T`] [`function_type_t<T>`]] 0076 [[`void(int)`] [`void(int)`]] 0077 [[`void(int) const`] [`void(int)`]] 0078 [[`void(int) transaction_safe`] [`void(int)`]] 0079 [[`void(*const &)(int)`] [`void(int)`]] 0080 [[`void(&)(int)`] [`void(int)`]] 0081 [[`void(* volatile)()`] [`void()`]] 0082 [[`int(foo::*)(int)`] [`int(foo&, int)`]] 0083 [[`int(foo::*)(int) const`] [`int(const foo&, int)`]] 0084 [[`void(foo::*)() volatile &&`] [`void(volatile foo&&)`]] 0085 [[`int foo::*`] [`int(const foo&)`]] 0086 [[`const int foo::*`] [`int(const foo&)`]] 0087 [[`int`] [(substitution failure)]] 0088 ] 0089 0090 [heading Example Program] 0091 [import ../example/function_type.cpp] 0092 [function_type] 0093 [endsect] 0094 */ 0095 //] 0096 0097 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |