|
Boost-Commit : |
From: eric_at_[hidden]
Date: 2007-12-30 00:57:54
Author: eric_niebler
Date: 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
New Revision: 42363
URL: http://svn.boost.org/trac/boost/changeset/42363
Log:
all proto tests pass with or without variadics and rvalue refs
Text files modified:
branches/proto/v3/boost/xpressive/proto/detail/apply_args.hpp | 12 ++++++------
branches/proto/v3/boost/xpressive/proto/detail/by_value_generator.hpp | 2 +-
branches/proto/v3/boost/xpressive/proto/detail/cat_args.hpp | 2 +-
branches/proto/v3/boost/xpressive/proto/detail/deep_copy.hpp | 2 +-
branches/proto/v3/boost/xpressive/proto/detail/is_callable.hpp | 4 ++--
branches/proto/v3/boost/xpressive/proto/detail/make.hpp | 23 +++++++++++++++++++++++
branches/proto/v3/boost/xpressive/proto/detail/nary_expr.hpp | 2 +-
branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp | 2 +-
branches/proto/v3/boost/xpressive/proto/traits.hpp | 14 +++++++++++---
branches/proto/v3/boost/xpressive/proto/transform/make.hpp | 10 ++++++++++
10 files changed, 57 insertions(+), 16 deletions(-)
Modified: branches/proto/v3/boost/xpressive/proto/detail/apply_args.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/apply_args.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/apply_args.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -22,7 +22,7 @@
template<typename E, typename S, typename V, typename G>
struct apply_args;
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<typename Prev, typename... G>
struct pad_args
{
@@ -60,7 +60,7 @@
#undef TMP
template<typename Cons>
- static typename type::cons_type call(Cons const &a, S const &s, V &v)
+ static typename type::cons_type call(Cons const &a, S s, V v)
{
#define TMP0(Z, N, DATA) .cdr
#define TMP1(Z, N, DATA) {G##N()(a BOOST_PP_REPEAT_ ## Z(N, TMP0, ~) .car, s, v)
@@ -89,7 +89,7 @@
#else
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<typename Prev BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename G)>
struct pad_args<Prev BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), G)>
{
@@ -107,7 +107,7 @@
, typename S
, typename V
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, typename G)
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
, typename... GRest
#endif
>
@@ -117,7 +117,7 @@
, V
, args<
BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, G)
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
, GRest...
#endif
>
@@ -128,7 +128,7 @@
#undef TMP
template<typename Cons>
- static typename type::cons_type call(Cons const &a, S const &s, V &v)
+ static typename type::cons_type call(Cons const &a, S s, V v)
{
#define TMP0(Z, N, DATA) .cdr
#define TMP1(Z, N, DATA) {G##N()(a BOOST_PP_REPEAT_ ## Z(N, TMP0, ~) .car, s, v)
Modified: branches/proto/v3/boost/xpressive/proto/detail/by_value_generator.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/by_value_generator.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/by_value_generator.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -35,7 +35,7 @@
}
};
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<
BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, typename A)
, typename... Rest
Modified: branches/proto/v3/boost/xpressive/proto/detail/cat_args.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/cat_args.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/cat_args.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -16,7 +16,7 @@
namespace detail
{
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<typename A0, typename A1>
struct cat_args;
Modified: branches/proto/v3/boost/xpressive/proto/detail/deep_copy.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/deep_copy.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/deep_copy.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -35,7 +35,7 @@
}
};
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<
BOOST_PP_ENUM_PARAMS(BOOST_PROTO_MAX_ARITY, typename A)
, typename... Rest
Modified: branches/proto/v3/boost/xpressive/proto/detail/is_callable.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/is_callable.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/is_callable.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -34,7 +34,7 @@
: is_callable2_<T>
{};
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<typename... Args>
struct back;
@@ -65,7 +65,7 @@
#define N BOOST_PP_ITERATION()
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
struct back<BOOST_PP_ENUM_PARAMS(N, A)>
{
Modified: branches/proto/v3/boost/xpressive/proto/detail/make.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/make.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/make.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -94,6 +94,29 @@
}
};
+ #if BOOST_WORKAROUND(__GNUC__, == 3)
+ // work around GCC bug
+ template<typename Tag, typename Args, long Arity BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
+ struct make<expr<Tag, Args, Arity>(BOOST_PP_ENUM_PARAMS(N, A))> : callable
+ {
+ template<typename Sig>
+ struct result
+ {
+ typedef expr<Tag, Args, Arity> type;
+ };
+
+ template<typename Expr, typename State, typename Visitor>
+ expr<Tag, Args, Arity> operator()(Expr const &expr, State const &state, Visitor &visitor) const
+ {
+ return proto::construct<proto::expr<Tag, Args, Arity> >(
+ #define TMP(Z, M, DATA) detail::as_lvalue(when<_, BOOST_PP_CAT(A, M)>()(expr, state, visitor))
+ BOOST_PP_ENUM(N, TMP, DATA)
+ #undef TMP
+ );
+ }
+ };
+ #endif
+
#undef N
#endif
Modified: branches/proto/v3/boost/xpressive/proto/detail/nary_expr.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/detail/nary_expr.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/detail/nary_expr.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -21,7 +21,7 @@
namespace op
{
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<typename Tag BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, typename A), typename... Rest>
struct nary_expr<Tag BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PROTO_MAX_ARITY, A), Rest...>
{
Modified: branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -358,7 +358,7 @@
template<typename Tag, typename T> struct unary_expr;
template<typename Tag, typename T, typename U> struct binary_expr;
- #if defined(BOOST_HAS_VARIADIC_TMPL) && defined(BOOST_HAS_RVALUE_REFS)
+ #ifdef BOOST_HAS_VARIADIC_TMPL
template<typename... Args> struct function;
template<typename Tag, typename... Args> struct nary_expr;
#else
Modified: branches/proto/v3/boost/xpressive/proto/traits.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/traits.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/traits.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -451,7 +451,7 @@
return result_of::arg_c<Expr const, N>::call(expr.proto_base().proto_args_);
}
-#ifdef BOOST_HAS_RVALUE_REFS
+ #ifdef BOOST_HAS_RVALUE_REFS
template<typename T>
typename result_of::as_expr<T>::type const as_expr(T &&t)
{
@@ -475,7 +475,7 @@
{
return result_of::as_expr_ref<T, Domain>::call(t);
}
-#else
+ #else
template<typename T>
typename result_of::as_expr<T &>::type const as_expr(T &t BOOST_PROTO_DISABLE_IF_IS_CONST(T))
{
@@ -523,7 +523,7 @@
{
return result_of::as_expr_ref<T const &, Domain>::call(t);
}
-#endif
+ #endif
/// is_callable
///
@@ -537,6 +537,14 @@
: mpl::false_
{};
+ #if BOOST_WORKAROUND(__GNUC__, == 3)
+ // work around GCC bug
+ template<typename Tag, typename Args, long N>
+ struct is_callable<proto::expr<Tag, Args, N> >
+ : mpl::false_
+ {};
+ #endif
+
/// is_aggregate
///
template<typename T>
Modified: branches/proto/v3/boost/xpressive/proto/transform/make.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/make.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/make.hpp 2007-12-30 00:57:53 EST (Sun, 30 Dec 2007)
@@ -89,6 +89,16 @@
: make_<R, Expr, State, Visitor>
{};
+ #if BOOST_WORKAROUND(__GNUC__, == 3)
+ // work around GCC bug
+ template<typename Tag, typename Args, long N, typename Expr, typename State, typename Visitor>
+ struct make_if_<expr<Tag, Args, N>, Expr, State, Visitor, false>
+ {
+ typedef expr<Tag, Args, N> type;
+ typedef void not_applied_;
+ };
+ #endif
+
template<typename R, typename Expr, typename State, typename Visitor>
struct make_if_<R, Expr, State, Visitor, true>
: remove_const<typename remove_reference<
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk