1 ///////////////////////////////////////////////////////////////////////////////
2 /// \file args.hpp
3 /// Contains definition of \c term\<\>, \c list1\<\>, \c list2\<\>, ...
4 /// class templates.
5 //
6 //  Copyright 2008 Eric Niebler. Distributed under the Boost
7 //  Software License, Version 1.0. (See accompanying file
8 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 
10 #ifndef BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
11 #define BOOST_PROTO_ARGS_HPP_EAN_04_01_2005
12 
13 #include <boost/preprocessor/cat.hpp>
14 #include <boost/preprocessor/arithmetic/dec.hpp>
15 #include <boost/preprocessor/iteration/iterate.hpp>
16 #include <boost/preprocessor/repetition/enum_params.hpp>
17 #include <boost/preprocessor/repetition/repeat.hpp>
18 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
19 #include <boost/mpl/if.hpp>
20 #include <boost/mpl/void.hpp>
21 #include <boost/proto/proto_fwd.hpp>
22 #include <boost/proto/detail/is_noncopyable.hpp>
23 
24 #include <boost/mpl/or.hpp>
25 #include <boost/type_traits/is_function.hpp>
26 #include <boost/type_traits/is_abstract.hpp>
27 
28 namespace boost { namespace proto
29 {
30     namespace detail
31     {
32         /// INTERNAL ONLY
33         template<typename Expr>
34         struct expr_traits
35         {
36             typedef Expr value_type;
37             typedef Expr &reference;
38             typedef Expr const &const_reference;
39         };
40 
41         /// INTERNAL ONLY
42         template<typename Expr>
43         struct expr_traits<Expr &>
44         {
45             typedef Expr value_type;
46             typedef Expr &reference;
47             typedef Expr &const_reference;
48         };
49 
50         /// INTERNAL ONLY
51         template<typename Expr>
52         struct expr_traits<Expr const &>
53         {
54             typedef Expr value_type;
55             typedef Expr const &reference;
56             typedef Expr const &const_reference;
57         };
58 
59         /// INTERNAL ONLY
60         template<typename T>
61         struct term_traits
62         {
63             typedef T value_type;
64             typedef T &reference;
65             typedef T const &const_reference;
66         };
67 
68         /// INTERNAL ONLY
69         template<typename T>
70         struct term_traits<T &>
71         {
72             typedef typename mpl::if_c<is_noncopyable<T>::value, T &, T>::type value_type;
73             typedef T &reference;
74             typedef T &const_reference;
75         };
76 
77         /// INTERNAL ONLY
78         template<typename T>
79         struct term_traits<T const &>
80         {
81             typedef T value_type;
82             typedef T const &reference;
83             typedef T const &const_reference;
84         };
85 
86         /// INTERNAL ONLY
87         template<typename T, std::size_t N>
88         struct term_traits<T (&)[N]>
89         {
90             typedef T value_type[N];
91             typedef T (&reference)[N];
92             typedef T (&const_reference)[N];
93         };
94 
95         /// INTERNAL ONLY
96         template<typename T, std::size_t N>
97         struct term_traits<T const (&)[N]>
98         {
99             typedef T value_type[N];
100             typedef T const (&reference)[N];
101             typedef T const (&const_reference)[N];
102         };
103 
104         /// INTERNAL ONLY
105         template<typename T, std::size_t N>
106         struct term_traits<T[N]>
107         {
108             typedef T value_type[N];
109             typedef T (&reference)[N];
110             typedef T const (&const_reference)[N];
111         };
112 
113         /// INTERNAL ONLY
114         template<typename T, std::size_t N>
115         struct term_traits<T const[N]>
116         {
117             typedef T value_type[N];
118             typedef T const (&reference)[N];
119             typedef T const (&const_reference)[N];
120         };
121     }
122 
123     namespace argsns_
124     {
125         // This is where term and all the different listN templates are defined
126         #include <boost/proto/detail/args.hpp>
127     }
128 
129 }}
130 
131 #endif
132 
133