Update of /cvsroot/boost/boost/boost/xpressive/proto
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4721/proto
Modified Files:
matches.hpp traits.hpp
Log Message:
traits clean-up, fix as_expr("x")
Index: matches.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/matches.hpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- matches.hpp 26 Jan 2007 03:06:15 -0000 1.29
+++ matches.hpp 29 Jan 2007 16:56:17 -0000 1.30
@@ -108,34 +108,22 @@
template<typename Tag, typename Args1, typename Args2>
struct matches_impl< expr<Tag, Args1, 1>, expr<Tag, Args2, 1> >
- : matches_impl<
- typename Args1::arg0::type
- , typename Args2::arg0::type
- >
+ : matches_impl<typename Args1::arg0::type, typename
Args2::arg0::type>
{};
template<typename Tag, typename Args1, typename Args2>
struct matches_impl< expr<Tag, Args1, 1>, expr<proto::_, Args2, 1>
>
- : matches_impl<
- typename Args1::arg0::type
- , typename Args2::arg0::type
- >
+ : matches_impl<typename Args1::arg0::type, typename
Args2::arg0::type>
{};
template<typename Args1, typename Args2>
struct matches_impl< expr<tag::terminal, Args1, 1>,
expr<tag::terminal, Args2, 1> >
- : terminal_matches<
- typename Args1::arg0
- , typename Args2::arg0
- >
+ : terminal_matches<typename Args1::arg0, typename Args2::arg0>
{};
template<typename Args1, typename Args2>
struct matches_impl< expr<tag::terminal, Args1, 1>, expr<proto::_,
Args2, 1> >
- : terminal_matches<
- typename Args1::arg0
- , typename Args2::arg0
- >
+ : terminal_matches<typename Args1::arg0, typename Args2::arg0>
{};
#define BOOST_PROTO_MATCHES_N_FUN(z, n, data)\
@@ -261,8 +249,7 @@
struct BOOST_PP_CAT(or, N)
: BOOST_PP_CAT(or, BOOST_PP_DEC(N))<
matches_impl<Expr, typename G1::type>::value
- , Expr
- , BOOST_PP_ENUM_SHIFTED_PARAMS(N, G)
+ , Expr, BOOST_PP_ENUM_SHIFTED_PARAMS(N, G)
>
{};
Index: traits.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/xpressive/proto/traits.hpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- traits.hpp 27 Jan 2007 04:02:07 -0000 1.31
+++ traits.hpp 29 Jan 2007 16:56:17 -0000 1.32
@@ -25,7 +25,6 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/bool.hpp>
- #include <boost/call_traits.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/xpressive/proto/proto_fwd.hpp>
@@ -67,13 +66,45 @@
template<typename T, typename EnableIf>
struct as_expr
{
- typedef expr<proto::tag::terminal, args1<typename
call_traits<T>::value_type> > type;
+ typedef expr<proto::tag::terminal, args1<T> > type;
+
+ private:
+ friend struct op::as_expr;
+ typedef type result_type;
+ static result_type call(T const &t)
+ {
+ type that = {t};
+ return that;
+ }
+ };
+
+ template<typename T, std::size_t N>
+ struct as_expr<T [N], void>
+ {
+ typedef expr<proto::tag::terminal, args1<T (&)[N]> > type;
+
+ private:
+ friend struct op::as_expr;
+ typedef type result_type;
+ static result_type call(T (&t)[N])
+ {
+ type that = {t};
+ return that;
+ }
};
template<typename T>
struct as_expr<T, typename T::is_boost_proto_expr_>
{
typedef T type;
+
+ private:
+ friend struct op::as_expr;
+ typedef T const &result_type;
+ static result_type call(T const &t)
+ {
+ return t;
+ }
};
// as_expr_ref
@@ -254,35 +285,22 @@
: meta::as_expr<typename meta::value_type<T>::type>
{};
- template<typename T>
- ref<T> const &operator()(ref<T> const &t) const
- {
- return t;
- }
-
- template<typename T>
- typename mpl::if_<
- meta::is_expr<T>
- , typename meta::as_expr<T>::type const &
- , typename meta::as_expr<T>::type
- >::type
- operator()(T const &t) const
+ template<typename T, std::size_t N>
+ typename meta::as_expr<T[N]>::result_type operator()(T
(&t)[N]) const
{
- return as_expr::call(t, meta::is_expr<T>());
+ return meta::as_expr<T[N]>::call(t);
}
- private:
- template<typename T>
- static typename meta::as_expr<T>::type const &call(T const &t,
mpl::true_)
+ template<typename T, std::size_t N>
+ typename meta::as_expr<T const[N]>::result_type operator()(T
const (&t)[N]) const
{
- return t;
+ return meta::as_expr<T const[N]>::call(t);
}
template<typename T>
- static typename meta::as_expr<T>::type call(T const &t,
mpl::false_)
+ typename meta::as_expr<T>::result_type operator()(T const &t)
const
{
- typename meta::as_expr<T>::type that = {t};
- return that;
+ return meta::as_expr<T>::call(t);
}
};
@@ -341,7 +359,7 @@
{};
template<typename Expr>
- typename meta::arg_c<Expr, N>::type const &operator()(Expr
const &expr) const
+ typename meta::arg_c<Expr, N>::reference operator()(Expr const
&expr) const
{
return meta::arg_c<Expr, N>::call(expr);
}
@@ -359,7 +377,7 @@
{};
template<typename Expr>
- typename meta::arg<Expr, N>::type const &operator()(Expr const
&expr) const
+ typename meta::arg<Expr, N>::reference operator()(Expr const
&expr) const
{
return meta::arg<Expr, N>::call(expr);
}
@@ -376,7 +394,7 @@
{};
template<typename Expr>
- typename meta::left<Expr>::type const &operator()(Expr const
&expr) const
+ typename meta::left<Expr>::reference operator()(Expr const
&expr) const
{
return proto::unref(expr.cast().arg0);
}
@@ -393,7 +411,7 @@
{};
template<typename Expr>
- typename meta::right<Expr>::type const &operator()(Expr const
&expr) const
+ typename meta::right<Expr>::reference operator()(Expr const
&expr) const
{
return proto::unref(expr.cast().arg1);
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs