| 1 | #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES) |
| 2 | |
| 3 | #include <boost/proto/detail/preprocessed/poly_function_traits.hpp> |
| 4 | |
| 5 | #elif !defined(BOOST_PP_IS_ITERATING) |
| 6 | |
| 7 | #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) |
| 8 | #pragma wave option(preserve: 2, line: 0, output: "preprocessed/poly_function_traits.hpp") |
| 9 | #endif |
| 10 | |
| 11 | /////////////////////////////////////////////////////////////////////////////// |
| 12 | // poly_function_traits.hpp |
| 13 | // Contains specializations of poly_function_traits and as_mono_function |
| 14 | // |
| 15 | // Copyright 2008 Eric Niebler. Distributed under the Boost |
| 16 | // Software License, Version 1.0. (See accompanying file |
| 17 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 18 | |
| 19 | #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) |
| 20 | #pragma wave option(preserve: 1) |
| 21 | #endif |
| 22 | |
| 23 | #define BOOST_PP_ITERATION_PARAMS_1 \ |
| 24 | (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/poly_function_traits.hpp>)) |
| 25 | #include BOOST_PP_ITERATE() |
| 26 | |
| 27 | #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) |
| 28 | #pragma wave option(output: null) |
| 29 | #endif |
| 30 | |
| 31 | #else |
| 32 | |
| 33 | #define N BOOST_PP_ITERATION() |
| 34 | |
| 35 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| 36 | template<typename PolyFun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> |
| 37 | struct poly_function_traits<PolyFun, PolyFun(BOOST_PP_ENUM_PARAMS(N, A)), mpl::size_t<sizeof(poly_function_t)> > |
| 38 | { |
| 39 | typedef typename PolyFun::template impl<BOOST_PP_ENUM_PARAMS(N, const A)> function_type; |
| 40 | typedef typename function_type::result_type result_type; |
| 41 | }; |
| 42 | |
| 43 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| 44 | template<typename PolyFun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> |
| 45 | struct as_mono_function_impl<PolyFun(BOOST_PP_ENUM_PARAMS(N, A)), true> |
| 46 | { |
| 47 | typedef typename PolyFun::template impl<BOOST_PP_ENUM_PARAMS(N, const A)> type; |
| 48 | }; |
| 49 | |
| 50 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| 51 | template<typename PolyFun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> |
| 52 | struct as_mono_function_impl<PolyFun(BOOST_PP_ENUM_PARAMS(N, A)), false> |
| 53 | { |
| 54 | typedef PolyFun type; |
| 55 | }; |
| 56 | |
| 57 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| 58 | template<typename PolyFun BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> |
| 59 | struct as_mono_function<PolyFun(BOOST_PP_ENUM_PARAMS(N, A))> |
| 60 | : as_mono_function_impl<PolyFun(BOOST_PP_ENUM_PARAMS(N, A)), is_poly_function<PolyFun>::value> |
| 61 | {}; |
| 62 | |
| 63 | #undef N |
| 64 | |
| 65 | #endif // BOOST_PROTO_DONT_USE_PREPROCESSED_FILES |
| 66 | |