2 /* Do not edit! -- generated file */
5 #ifndef _SIGC_ADAPTORS_DEDUCE_RESULT_TYPE_H_
6 #define _SIGC_ADAPTORS_DEDUCE_RESULT_TYPE_H_
7 #include <sigc++/functors/functor_trait.h>
11 /** A hint to the compiler.
12 * Functors which have all methods based on templates
13 * should publicly inherit from this hint and define
14 * a nested template class @p deduce_result_type that
15 * can be used to deduce the methods' return types.
17 * adaptor_base inherits from the functor_base hint so
18 * derived types should also have a result_type defined.
20 * Adaptors don't inherit from this type directly. They use
21 * use sigc::adapts as a base type instead. sigc::adaptors
22 * wraps arbitrary functor types as well as function pointers
27 struct adaptor_base : public functor_base {};
30 /** Deduce the return type of a functor.
31 * <tt>typename deduce_result_type<functor_type, list of arg_types>::type</tt>
32 * deduces a functor's result type if @p functor_type inherits from
33 * sigc::functor_base and defines @p result_type or if @p functor_type
34 * is actually a (member) function type. Multi-type functors are not
38 * <tt>typename deduce_result_type<functor_type, list of arg_types>::type</tt>
39 * to determine the return type of their <tt>templated operator()</tt> overloads.
41 * Adaptors in turn define a nested template class @p deduce_result_type
42 * that is used by template specializations of the global deduce_result_type
43 * template to correctly deduce the return types of the adaptor's suitable
44 * <tt>template operator()</tt> overload.
48 template<class T_functor, class... T_args>
49 struct deduce_result_type
51 //The compiler will choose this method overload if T_functor derives from adaptor_base,
52 //and if it has its own deduce_result_type member (which has its own ::type member).
53 template<class U_functor, typename = typename std::is_base_of<adaptor_base, T_functor>::type>
55 typename U_functor::template deduce_result_type<T_args...>::type
58 //Otherwise, the compiler will choose this fallback method.
59 template<class U_functor>
61 typename functor_trait<T_functor>::result_type
64 using type = decltype (test<T_functor> ());
67 template<typename T_functor, typename... T_args>
68 using deduce_result_t = typename deduce_result_type<T_functor, T_args...>::type;
70 } /* namespace sigc */
71 #endif /* _SIGC_ADAPTORS_DEDUCE_RESULT_TYPE_H_ */