1 #ifndef BOOST_METAPARSE_V1_UTIL_IN_RANGE_HPP
2 #define BOOST_METAPARSE_V1_UTIL_IN_RANGE_HPP
3 
4 // Copyright Abel Sinkovics (abel@sinkovics.hu)  2009 - 2010.
5 // Distributed under the Boost Software License, Version 1.0.
6 //    (See accompanying file LICENSE_1_0.txt or copy at
7 //          http://www.boost.org/LICENSE_1_0.txt)
8 
9 #include <boost/mpl/less_equal.hpp>
10 #include <boost/mpl/comparison.hpp>
11 #include <boost/mpl/quote.hpp>
12 #include <boost/mpl/bool.hpp>
13 
14 #include <boost/mpl/vector.hpp>
15 
16 namespace boost
17 {
18   namespace metaparse
19   {
20     namespace v1
21     {
22       namespace util
23       {
24         template <
25           class LowerBound = boost::mpl::na,
26           class UpperBound = boost::mpl::na,
27           class Item = boost::mpl::na
28         >
29         struct in_range :
30           boost::mpl::bool_<
31             boost::mpl::less_equal<LowerBound, Item>::type::value
32             && boost::mpl::less_equal<Item, UpperBound>::type::value
33           >
34         {};
35 
36         template <class LowerBound, class UpperBound>
37         struct in_range<LowerBound, UpperBound, boost::mpl::na>
38         {
39           typedef in_range type;
40 
41           template <class Item = boost::mpl::na>
42           struct apply : in_range<LowerBound, UpperBound, Item> {};
43         };
44 
45         template <class LowerBound>
46         struct in_range<LowerBound, boost::mpl::na, boost::mpl::na>
47         {
48           typedef in_range type;
49 
50           template <
51             class UpperBound = boost::mpl::na,
52             class Item = boost::mpl::na
53           >
54           struct apply : in_range<LowerBound, UpperBound, Item> {};
55         };
56 
57         template <>
58         struct in_range<boost::mpl::na, boost::mpl::na, boost::mpl::na>
59         {
60           typedef in_range type;
61 
62           template <
63             class LowerBound = boost::mpl::na,
64             class UpperBound = boost::mpl::na,
65             class Item = boost::mpl::na
66           >
67           struct apply : in_range<LowerBound, UpperBound, Item> {};
68         };
69       }
70     }
71   }
72 }
73 
74 #endif
75 
76