| 1 | // Boost result_of library |
|---|
| 2 | |
|---|
| 3 | // Copyright Douglas Gregor 2004. Use, modification and |
|---|
| 4 | // distribution is subject to the Boost Software License, Version |
|---|
| 5 | // 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
|---|
| 6 | // http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 7 | |
|---|
| 8 | // For more information, see http://www.boost.org/libs/utility |
|---|
| 9 | #if !defined(BOOST_PP_IS_ITERATING) |
|---|
| 10 | # error Boost result_of - do not include this file! |
|---|
| 11 | #endif |
|---|
| 12 | |
|---|
| 13 | // CWPro8 requires an argument in a function type specialization |
|---|
| 14 | #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0 |
|---|
| 15 | # define BOOST_RESULT_OF_ARGS void |
|---|
| 16 | #else |
|---|
| 17 | # define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T) |
|---|
| 18 | #endif |
|---|
| 19 | |
|---|
| 20 | #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) |
|---|
| 21 | template<typename F BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) |
|---|
| 22 | BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> |
|---|
| 23 | struct result_of<F(BOOST_RESULT_OF_ARGS)> |
|---|
| 24 | : detail::result_of<F, F(BOOST_RESULT_OF_ARGS)> {}; |
|---|
| 25 | #endif |
|---|
| 26 | |
|---|
| 27 | namespace detail { |
|---|
| 28 | |
|---|
| 29 | template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) |
|---|
| 30 | BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> |
|---|
| 31 | struct result_of<R (*)(BOOST_RESULT_OF_ARGS), FArgs> |
|---|
| 32 | { |
|---|
| 33 | typedef R type; |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) |
|---|
| 37 | BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> |
|---|
| 38 | struct result_of<R (&)(BOOST_RESULT_OF_ARGS), FArgs> |
|---|
| 39 | { |
|---|
| 40 | typedef R type; |
|---|
| 41 | }; |
|---|
| 42 | |
|---|
| 43 | #undef BOOST_RESULT_OF_ARGS |
|---|
| 44 | |
|---|
| 45 | #if BOOST_PP_ITERATION() > 1 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) |
|---|
| 46 | template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) |
|---|
| 47 | BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> |
|---|
| 48 | struct result_of<R (T0::*) |
|---|
| 49 | (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)), |
|---|
| 50 | FArgs> |
|---|
| 51 | { |
|---|
| 52 | typedef R type; |
|---|
| 53 | }; |
|---|
| 54 | |
|---|
| 55 | template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) |
|---|
| 56 | BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> |
|---|
| 57 | struct result_of<R (T0::*) |
|---|
| 58 | (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) |
|---|
| 59 | const, |
|---|
| 60 | FArgs> |
|---|
| 61 | { |
|---|
| 62 | typedef R type; |
|---|
| 63 | }; |
|---|
| 64 | |
|---|
| 65 | template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) |
|---|
| 66 | BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> |
|---|
| 67 | struct result_of<R (T0::*) |
|---|
| 68 | (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) |
|---|
| 69 | volatile, |
|---|
| 70 | FArgs> |
|---|
| 71 | { |
|---|
| 72 | typedef R type; |
|---|
| 73 | }; |
|---|
| 74 | |
|---|
| 75 | template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) |
|---|
| 76 | BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)> |
|---|
| 77 | struct result_of<R (T0::*) |
|---|
| 78 | (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) |
|---|
| 79 | const volatile, |
|---|
| 80 | FArgs> |
|---|
| 81 | { |
|---|
| 82 | typedef R type; |
|---|
| 83 | }; |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|
| 86 | } |
|---|