Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:30

0001 // Boost result_of library
0002 
0003 //  Copyright Douglas Gregor 2004. Use, modification and
0004 //  distribution is subject to the Boost Software License, Version
0005 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 
0008 //  Copyright Daniel Walker, Eric Niebler, Michel Morin 2008-2012.
0009 //  Use, modification and distribution is subject to the Boost Software
0010 //  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or
0011 //  copy at http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 // For more information, see http://www.boost.org/libs/utility
0014 
0015 #ifndef BOOST_RESULT_OF_HPP
0016 # error Boost result_of - do not include this file!
0017 #endif
0018 
0019 template<typename F, typename... Args>
0020 struct tr1_result_of<F(Args...)>
0021     : conditional<
0022         is_pointer<F>::value || is_member_function_pointer<F>::value
0023         , boost::detail::tr1_result_of_impl<
0024             typename remove_cv<F>::type,
0025             typename remove_cv<F>::type(Args...),
0026             (boost::detail::result_of_has_result_type<F>::value)>
0027         , boost::detail::tr1_result_of_impl<
0028             F,
0029             F(Args...),
0030             (boost::detail::result_of_has_result_type<F>::value)> >::type { };
0031 
0032 #ifdef BOOST_RESULT_OF_USE_DECLTYPE
0033 template<typename F, typename... Args>
0034 struct result_of<F(Args...)>
0035     : detail::cpp0x_result_of<F(Args...)> { };
0036 #endif // BOOST_RESULT_OF_USE_DECLTYPE
0037 
0038 #ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
0039 template<typename F, typename... Args>
0040 struct result_of<F(Args...)>
0041     : conditional<detail::result_of_has_result_type<F>::value || detail::result_of_has_result<F>::value,
0042                tr1_result_of<F(Args...)>,
0043                detail::cpp0x_result_of<F(Args...)> >::type { };
0044 #endif // BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
0045 
0046 #if defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
0047 
0048 namespace detail {
0049 
0050 template<typename F, typename... Args>
0051 struct cpp0x_result_of<F(Args...)>
0052     : conditional<
0053           is_member_function_pointer<F>::value
0054         , detail::tr1_result_of_impl<
0055             typename remove_cv<F>::type,
0056             typename remove_cv<F>::type(Args...), false
0057           >
0058         , detail::cpp0x_result_of_impl<
0059               F(Args...)
0060           >
0061       >::type
0062 {};
0063 
0064 #ifdef BOOST_NO_SFINAE_EXPR
0065 
0066 template<typename F>
0067 struct result_of_callable_fun_2;
0068 
0069 template<typename R, typename... Args>
0070 struct result_of_callable_fun_2<R(Args...)> {
0071     R operator()(Args...) const;
0072     typedef result_of_private_type const &(*pfn_t)(...);
0073     operator pfn_t() const volatile;
0074 };
0075 
0076 template<typename F>
0077 struct result_of_callable_fun
0078   : result_of_callable_fun_2<F>
0079 {};
0080 
0081 template<typename F>
0082 struct result_of_callable_fun<F *>
0083   : result_of_callable_fun_2<F>
0084 {};
0085 
0086 template<typename F>
0087 struct result_of_select_call_wrapper_type
0088   : conditional<
0089         is_class<typename remove_reference<F>::type>::value,
0090         result_of_wrap_callable_class<F>,
0091         type_identity<result_of_callable_fun<typename remove_cv<typename remove_reference<F>::type>::type> >
0092     >::type
0093 {};
0094 
0095 template<typename F, typename... Args>
0096 struct result_of_is_callable {
0097     typedef typename result_of_select_call_wrapper_type<F>::type wrapper_t;
0098     static const bool value = (
0099         sizeof(result_of_no_type) == sizeof(detail::result_of_is_private_type(
0100             (boost::declval<wrapper_t>()(boost::declval<Args>()...), result_of_weird_type())
0101         ))
0102     );
0103     typedef integral_constant<bool, value> type;
0104 };
0105 
0106 template<typename F, typename... Args>
0107 struct cpp0x_result_of_impl<F(Args...), true>
0108     : lazy_enable_if<
0109           result_of_is_callable<F, Args...>
0110         , cpp0x_result_of_impl<F(Args...), false>
0111       >
0112 {};
0113 
0114 template<typename F, typename... Args>
0115 struct cpp0x_result_of_impl<F(Args...), false>
0116 {
0117   typedef decltype(
0118     boost::declval<F>()(
0119       boost::declval<Args>()...
0120     )
0121   ) type;
0122 };
0123 
0124 #else // BOOST_NO_SFINAE_EXPR
0125 
0126 template<typename F, typename... Args>
0127 struct cpp0x_result_of_impl<F(Args...),
0128                             typename result_of_always_void<decltype(
0129                                 boost::declval<F>()(
0130                                     boost::declval<Args>()...
0131                                 )
0132                             )>::type> {
0133   typedef decltype(
0134     boost::declval<F>()(
0135       boost::declval<Args>()...
0136     )
0137   ) type;
0138 };
0139 
0140 #endif // BOOST_NO_SFINAE_EXPR
0141 
0142 } // namespace detail
0143 
0144 #else // defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
0145 
0146 template<typename F, typename... Args>
0147 struct result_of<F(Args...)>
0148     : tr1_result_of<F(Args...)> { };
0149 
0150 #endif // defined(BOOST_RESULT_OF_USE_DECLTYPE)
0151 
0152 namespace detail {
0153 
0154 template<typename R, typename FArgs, typename... Args>
0155 struct tr1_result_of_impl<R (*)(Args...), FArgs, false>
0156 {
0157   typedef R type;
0158 };
0159 
0160 template<typename R, typename FArgs, typename... Args>
0161 struct tr1_result_of_impl<R (&)(Args...), FArgs, false>
0162 {
0163   typedef R type;
0164 };
0165 
0166 template<typename R, typename FArgs, typename C, typename... Args>
0167 struct tr1_result_of_impl<R (C::*)(Args...), FArgs, false>
0168 {
0169   typedef R type;
0170 };
0171 
0172 template<typename R, typename FArgs, typename C, typename... Args>
0173 struct tr1_result_of_impl<R (C::*)(Args...) const, FArgs, false>
0174 {
0175   typedef R type;
0176 };
0177 
0178 template<typename R, typename FArgs, typename C, typename... Args>
0179 struct tr1_result_of_impl<R (C::*)(Args...) volatile, FArgs, false>
0180 {
0181   typedef R type;
0182 };
0183 
0184 template<typename R, typename FArgs, typename C, typename... Args>
0185 struct tr1_result_of_impl<R (C::*)(Args...) const volatile, FArgs, false>
0186 {
0187   typedef R type;
0188 };
0189 
0190 }