]> git.lyx.org Git - lyx.git/blob - boost/boost/utility/result_of.hpp
update to boost 1.39: add new files
[lyx.git] / boost / boost / utility / result_of.hpp
1 // Boost result_of library\r
2 \r
3 //  Copyright Douglas Gregor 2004. Use, modification and\r
4 //  distribution is subject to the Boost Software License, Version\r
5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at\r
6 //  http://www.boost.org/LICENSE_1_0.txt)\r
7 \r
8 // For more information, see http://www.boost.org/libs/utility\r
9 #ifndef BOOST_RESULT_OF_HPP\r
10 #define BOOST_RESULT_OF_HPP\r
11 \r
12 #include <boost/config.hpp>\r
13 #include <boost/type_traits/ice.hpp>\r
14 #include <boost/type.hpp>\r
15 #include <boost/preprocessor.hpp>\r
16 #include <boost/detail/workaround.hpp>\r
17 #include <boost/mpl/has_xxx.hpp>\r
18 #include <boost/mpl/if.hpp>\r
19 #include <boost/mpl/bool.hpp>\r
20 \r
21 #ifndef BOOST_RESULT_OF_NUM_ARGS\r
22 #  define BOOST_RESULT_OF_NUM_ARGS 10\r
23 #endif\r
24 \r
25 namespace boost {\r
26 \r
27 template<typename F> struct result_of;\r
28 \r
29 #if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
30 namespace detail {\r
31 \r
32 BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)\r
33 \r
34 template<typename F, typename FArgs, bool HasResultType> struct result_of_impl;\r
35 \r
36 template<typename F>\r
37 struct result_of_void_impl\r
38 {\r
39   typedef void type;\r
40 };\r
41 \r
42 template<typename R>\r
43 struct result_of_void_impl<R (*)(void)>\r
44 {\r
45   typedef R type;\r
46 };\r
47 \r
48 template<typename R>\r
49 struct result_of_void_impl<R (&)(void)>\r
50 {\r
51   typedef R type;\r
52 };\r
53 \r
54 template<typename F, typename FArgs>\r
55 struct result_of_impl<F, FArgs, true>\r
56 {\r
57   typedef typename F::result_type type;\r
58 };\r
59 \r
60 template<typename FArgs>\r
61 struct is_function_with_no_args : mpl::false_ {};\r
62 \r
63 template<typename F>\r
64 struct is_function_with_no_args<F(void)> : mpl::true_ {};\r
65 \r
66 template<typename F, typename FArgs>\r
67 struct result_of_nested_result : F::template result<FArgs>\r
68 {};\r
69 \r
70 template<typename F, typename FArgs>\r
71 struct result_of_impl<F, FArgs, false>\r
72   : mpl::if_<is_function_with_no_args<FArgs>,\r
73              result_of_void_impl<F>,\r
74              result_of_nested_result<F, FArgs> >::type\r
75 {};\r
76 \r
77 } // end namespace detail\r
78 \r
79 #define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>))\r
80 #include BOOST_PP_ITERATE()\r
81 \r
82 #else\r
83 #  define BOOST_NO_RESULT_OF 1\r
84 #endif\r
85 \r
86 }\r
87 \r
88 #endif // BOOST_RESULT_OF_HPP\r