Update of /cvsroot/boost/boost/boost/xpressive/proto
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10343/proto
Modified Files:
deep_copy.hpp expr.hpp traits.hpp
Log Message:
can make and initialize a (by-value) array terminal
Index: deep_copy.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/deep_copy.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- deep_copy.hpp 16 Jun 2007 05:46:15 -0000 1.16
+++ deep_copy.hpp 23 Jun 2007 06:26:31 -0000 1.17
@@ -36,8 +36,7 @@
template<typename Expr2>
static type call(Expr2 const &expr)
{
- expr_type that = {proto::arg(expr)};
- return Expr::proto_domain::make(that);
+ return
Expr::proto_domain::make(expr_type::make(proto::arg(expr)));
}
};
}
Index: expr.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/expr.hpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- expr.hpp 16 Jun 2007 05:46:15 -0000 1.36
+++ expr.hpp 23 Jun 2007 06:26:31 -0000 1.37
@@ -78,6 +78,25 @@
{
typedef Expr *type;
};
+
+ template<typename X, std::size_t N, typename Y>
+ void checked_copy(X (&x)[N], Y (&y)[N])
+ {
+ for(std::size_t i = 0; i < N; ++i)
+ {
+ y[i] = x[i];
+ }
+ }
+
+ template<typename T, std::size_t N>
+ struct if_is_array
+ {};
+
+ template<typename T, std::size_t N>
+ struct if_is_array<T[N], N>
+ {
+ typedef int type;
+ };
}
namespace result_of
@@ -177,6 +196,26 @@
expr that = {a0};
return that;
}
+
+ /// \overload
+ ///
+ template<typename A0, std::size_t N>
+ static expr make(A0 (&a0)[N], typename
detail::if_is_array<proto_arg0, N>::type = 0)
+ {
+ expr that;
+ detail::checked_copy(a0, that.arg0);
+ return that;
+ }
+
+ /// \overload
+ ///
+ template<typename A0, std::size_t N>
+ static expr make(A0 const (&a0)[N], typename
detail::if_is_array<proto_arg0, N>::type = 0)
+ {
+ expr that;
+ detail::checked_copy(a0, that.arg0);
+ return that;
+ }
#endif
#if 1 == BOOST_PP_ITERATION()
Index: traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/traits.hpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- traits.hpp 20 Jun 2007 04:02:23 -0000 1.58
+++ traits.hpp 23 Jun 2007 06:26:31 -0000 1.59
@@ -93,7 +93,7 @@
typedef expr<proto::tag::terminal, args0<proto_arg0> >
expr_type;
typedef typename Domain::template apply<expr_type>::type type;
- typedef type result_type;
+ typedef type const result_type;
template<typename T2>
static result_type call(T2 &t)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs