]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2011 Joel de Guzman | |
3 | Copyright (c) 2001-2011 Hartmut Kaiser | |
4 | ||
5 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
6 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
7 | ==============================================================================*/ | |
8 | #if !defined(BOOST_SPIRIT_LOCALS_APRIL_03_2007_0506PM) | |
9 | #define BOOST_SPIRIT_LOCALS_APRIL_03_2007_0506PM | |
10 | ||
11 | #if defined(_MSC_VER) | |
12 | #pragma once | |
13 | #endif | |
14 | ||
15 | #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp> | |
16 | #include <boost/preprocessor/repetition/enum_params.hpp> | |
17 | #include <boost/mpl/vector.hpp> | |
18 | #include <boost/mpl/bool.hpp> | |
19 | ||
20 | #if !defined(BOOST_SPIRIT_MAX_LOCALS_SIZE) | |
21 | # define BOOST_SPIRIT_MAX_LOCALS_SIZE 10 | |
22 | #else | |
23 | # if BOOST_SPIRIT_MAX_LOCALS_SIZE < 3 | |
24 | # undef BOOST_SPIRIT_MAX_LOCALS_SIZE | |
25 | # define BOOST_SPIRIT_MAX_LOCALS_SIZE 10 | |
26 | # endif | |
27 | #endif | |
28 | ||
29 | namespace boost { namespace spirit | |
30 | { | |
31 | /////////////////////////////////////////////////////////////////////////// | |
32 | template < | |
33 | BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT( | |
34 | BOOST_SPIRIT_MAX_LOCALS_SIZE, typename T, mpl::na) | |
35 | > | |
36 | struct locals | |
37 | : mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, T)> {}; | |
38 | ||
39 | /////////////////////////////////////////////////////////////////////////// | |
40 | namespace detail | |
41 | { | |
42 | template <typename T> | |
43 | struct is_locals | |
44 | : mpl::false_ | |
45 | {}; | |
46 | ||
47 | template <BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, typename T)> | |
48 | struct is_locals<locals<BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, T)> > | |
49 | : mpl::true_ | |
50 | {}; | |
51 | } | |
52 | }} | |
53 | ||
54 | #endif |