source: NonGTP/Boost/boost/parameter/match.hpp @ 857

Revision 857, 2.1 KB checked in by igarcia, 19 years ago (diff)
Line 
1// Copyright David Abrahams 2005. Distributed under the Boost
2// Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4#ifndef BOOST_PARAMETER_MATCH_DWA2005714_HPP
5# define BOOST_PARAMETER_MATCH_DWA2005714_HPP
6
7# include <boost/detail/workaround.hpp>
8# include <boost/preprocessor/seq/enum.hpp>
9
10# if BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
11// Temporary version of BOOST_PP_SEQ_ENUM until Paul M. integrates the workaround.
12#  define BOOST_PARAMETER_SEQ_ENUM_I(size,seq) BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, size) seq
13#  define BOOST_PARAMETER_SEQ_ENUM(seq) BOOST_PARAMETER_SEQ_ENUM_I(BOOST_PP_SEQ_SIZE(seq), seq)
14# else
15#  define BOOST_PARAMETER_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM(seq)
16# endif
17
18# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
19
20#  include <boost/parameter/config.hpp>
21#  include <boost/parameter/aux_/void.hpp>
22#  include <boost/preprocessor/arithmetic/sub.hpp>
23#  include <boost/preprocessor/facilities/intercept.hpp>
24#  include <boost/preprocessor/repetition/enum_trailing_params.hpp>
25
26#  define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes)              \
27        BOOST_PP_ENUM_TRAILING_PARAMS(                          \
28            BOOST_PP_SUB(                                       \
29                BOOST_PARAMETER_MAX_ARITY                       \
30              , BOOST_PP_SEQ_SIZE(ArgTypes)                     \
31            )                                                   \
32          , ::boost::parameter::aux::void_ BOOST_PP_INTERCEPT   \
33        )
34
35# else
36
37#  define BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes)
38
39# endif
40
41//
42// Generates, e.g.
43//
44//    typename dfs_params::match<A1,A2>::type name = dfs_params()
45//
46// with workarounds for Borland compatibility.
47//
48
49# define BOOST_PARAMETER_MATCH(ParameterSpec, ArgTypes, name)   \
50    typename ParameterSpec ::match<                             \
51        BOOST_PARAMETER_SEQ_ENUM(ArgTypes)                      \
52        BOOST_PARAMETER_MATCH_DEFAULTS(ArgTypes)                \
53    >::type name = ParameterSpec ()
54
55#endif // BOOST_PARAMETER_MATCH_DWA2005714_HPP
Note: See TracBrowser for help on using the repository browser.