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