Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/parameter/aux_/overloads.hpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 2.4 KB
Line 
1// Copyright David Abrahams, Daniel Wallin 2003. Use, modification and
2// distribution is subject to the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// This file generates overloads in this format:
7//
8//     template<class A0, class A1>
9//     typename mpl::apply_wrap1<
10//         aux::make_arg_list<
11//             PS0,A0
12//           , aux::make_arg_list<
13//                 PS1,A1
14//               , mpl::identity<aux::empty_arg_list>
15//             >
16//         >
17//      , unnamed_list
18//     >::type
19//     operator()(A0 const& a0, A1 const& a1) const
20//     {
21//         typedef typename mpl::apply_wrap1<
22//             aux::make_arg_list<
23//                 PS0,A0
24//               , aux::make_arg_list<
25//                     PS1,A1
26//                   , mpl::identity<aux::empty_arg_list>
27//                 >
28//             >
29//         >::type arg_tuple;
30//
31//         return arg_tuple(
32//             a0
33//           , a1
34//           , aux::void_()
35//             ...
36//         );
37//     }
38//
39
40#if !defined(BOOST_PP_IS_ITERATING)
41# error Boost.Parameters - do not include this file!
42#endif
43
44#define N BOOST_PP_ITERATION()
45
46#define BOOST_PARAMETER_open_list(z, n, text) \
47    aux::item< \
48        BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n)
49
50#define BOOST_PARAMETER_close_list(z, n, text) >
51
52#define BOOST_PARAMETER_arg_list(n) \
53    aux::make_arg_list< \
54        BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
55      , void_ \
56        BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
57      , deduced_list \
58      , aux::tag_keyword_arg \
59    >
60
61#define BOOST_PARAMETER_arg_pack_init(z, n, limit) \
62    BOOST_PP_CAT(a, BOOST_PP_SUB(limit,n))
63
64template<BOOST_PP_ENUM_PARAMS(N, class A)>
65typename mpl::first<
66    typename BOOST_PARAMETER_arg_list(N)::type
67>::type
68operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
69{
70    typedef typename BOOST_PARAMETER_arg_list(N)::type result;
71
72    typedef typename mpl::first<result>::type result_type;
73    typedef typename mpl::second<result>::type error;
74    error();
75
76    return result_type(
77        BOOST_PP_ENUM(N, BOOST_PARAMETER_arg_pack_init, BOOST_PP_DEC(N))
78        BOOST_PP_ENUM_TRAILING_PARAMS(
79            BOOST_PP_SUB(BOOST_PARAMETER_MAX_ARITY, N)
80          , aux::void_reference() BOOST_PP_INTERCEPT
81        ));
82}
83
84#undef BOOST_PARAMETER_arg_list
85#undef BOOST_PARAMETER_open_list
86#undef BOOST_PARAMETER_close_list
87#undef N
88
Note: See TracBrowser for help on using the repository browser.