|
Boost-Commit : |
From: eric_at_[hidden]
Date: 2007-12-01 20:24:11
Author: eric_niebler
Date: 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
New Revision: 41559
URL: http://svn.boost.org/trac/boost/changeset/41559
Log:
transforms now use the result_of protocol
Added:
branches/proto/v3/boost/xpressive/proto/transform/call.hpp
- copied, changed from r41525, /branches/proto/v3/boost/xpressive/proto/transform/bind.hpp
Removed:
branches/proto/v3/boost/xpressive/proto/transform/bind.hpp
Text files modified:
branches/proto/v3/boost/xpressive/detail/static/compile.hpp | 2
branches/proto/v3/boost/xpressive/detail/static/grammar.hpp | 15 +++----
branches/proto/v3/boost/xpressive/detail/static/visitor.hpp | 1
branches/proto/v3/boost/xpressive/proto/expr.hpp | 14 ------
branches/proto/v3/boost/xpressive/proto/extends.hpp | 12 ------
branches/proto/v3/boost/xpressive/proto/matches.hpp | 58 ++++++++++++++++++-----------
branches/proto/v3/boost/xpressive/proto/proto_fwd.hpp | 4 +-
branches/proto/v3/boost/xpressive/proto/traits.hpp | 61 ++++++++++++++++++------------
branches/proto/v3/boost/xpressive/proto/transform.hpp | 2
branches/proto/v3/boost/xpressive/proto/transform/apply.hpp | 77 ++++++++++++++++++++++-----------------
branches/proto/v3/boost/xpressive/proto/transform/arg.hpp | 53 +++++++++++++++++---------
branches/proto/v3/boost/xpressive/proto/transform/call.hpp | 38 +++++++++----------
branches/proto/v3/boost/xpressive/proto/transform/fold.hpp | 25 +++++++-----
branches/proto/v3/boost/xpressive/proto/transform/fold_tree.hpp | 32 ++++++++++------
branches/proto/v3/boost/xpressive/proto/transform/when.hpp | 48 +++++++++++++++---------
branches/proto/v3/libs/xpressive/proto/example/mixed.cpp | 2
branches/proto/v3/libs/xpressive/proto/example/rgb.cpp | 2
branches/proto/v3/libs/xpressive/proto/example/vec3.cpp | 2
branches/proto/v3/libs/xpressive/proto/test/examples.cpp | 76 +++++++++++++++++++++------------------
branches/proto/v3/libs/xpressive/proto/test/lambda.cpp | 2
branches/proto/v3/libs/xpressive/proto/test/main.cpp | 18 ++++----
branches/proto/v3/libs/xpressive/proto/test/toy_spirit.cpp | 2
22 files changed, 295 insertions(+), 251 deletions(-)
Modified: branches/proto/v3/boost/xpressive/detail/static/compile.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/compile.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/compile.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -41,7 +41,7 @@
// "compile" the regex and wrap it in an xpression_adaptor.
xpression_visitor<BidiIter, mpl::false_, Traits> visitor(traits, impl);
intrusive_ptr<matchable_ex<BidiIter> const> adxpr = make_adaptor<matchable_ex<BidiIter> >(
- Grammar<char_type>::call(xpr >> end_matcher(), no_next(), visitor)
+ Grammar<char_type>()(xpr >> end_matcher(), no_next(), visitor)
);
// Link and optimize the regex
Modified: branches/proto/v3/boost/xpressive/detail/static/grammar.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/grammar.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/grammar.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -501,9 +501,8 @@
{};
struct as_marker
- : apply_<
- _
- , _make_shift_right(
+ : call<
+ _make_shift_right(
mark_begin_matcher(mark_number(_arg(_left)))
, _make_shift_right(
_right
@@ -523,9 +522,8 @@
template<typename Greedy, typename Tag>
struct as_repeater
- : apply_<
- _
- , _make_shift_right(
+ : call<
+ _make_shift_right(
repeat_begin_matcher(mark_number(_arg(_left)))
, _make_shift_right(
_
@@ -600,9 +598,8 @@
{};
struct as_list_set
- : apply_<
- _
- , fill_list_set(
+ : call<
+ fill_list_set(
set_matcher<traits(_visitor), ListSet<Char>(_) >()
, _
, _visitor
Modified: branches/proto/v3/boost/xpressive/detail/static/visitor.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/detail/static/visitor.hpp (original)
+++ branches/proto/v3/boost/xpressive/detail/static/visitor.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -14,7 +14,6 @@
#endif
#include <boost/ref.hpp>
-#include <boost/mpl/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/xpressive/detail/detail_fwd.hpp>
#include <boost/xpressive/detail/core/regex_impl.hpp>
Modified: branches/proto/v3/boost/xpressive/proto/expr.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/expr.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/expr.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -55,7 +55,7 @@
typedef void type;
};
}
-
+
template<typename Tag, typename Args, long Arity>
struct expr
{
@@ -70,18 +70,6 @@
typename Args::cons_type proto_args_;
- template<typename Expr, typename, typename>
- struct apply
- {
- typedef Expr type;
- };
-
- template<typename Expr, typename State, typename Visitor>
- static Expr const &call(Expr const &expr, State const &, Visitor &)
- {
- return expr;
- }
-
template<typename... A>
static expr make(A &&... a)
{
Modified: branches/proto/v3/boost/xpressive/proto/extends.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/extends.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/extends.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -39,18 +39,6 @@
typedef void proto_is_expr_;\
typedef boost::proto::tag::proto_expr fusion_tag;\
\
- template<typename Expr_, typename, typename>\
- struct apply\
- {\
- typedef Expr_ type;\
- };\
- \
- template<typename Expr_, typename State, typename Visitor>\
- static Expr_ const &call(Expr_ const &expr, State const &, Visitor &)\
- {\
- return expr;\
- }\
- \
static Derived make(Expr const &expr)\
{\
Derived that = {expr};\
Modified: branches/proto/v3/boost/xpressive/proto/matches.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/matches.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/matches.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -367,7 +367,7 @@
template<typename Expr, typename If, typename Then, typename Else>
struct matches_<Expr, proto::if_<If, Then, Else> >
: mpl::eval_if<
- typename mpl::apply_wrap3<when<_, If>, Expr, mpl::void_, mpl::void_>::type
+ typename boost::result_of<when<_, If>(Expr, mpl::void_, mpl::void_)>::type
, matches_<Expr, typename Then::proto_base_expr>
, matches_<Expr, typename Else::proto_base_expr>
>::type
@@ -433,18 +433,23 @@
{
typedef or_ proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
- typedef typename detail::which<Expr, Alts...>::type
- ::template apply<Expr, State, Visitor>::type type;
+ typedef typename boost::result_of<
+ typename detail::which<Expr, Alts...>::type(Expr, State, Visitor)
+ >::type type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<or_(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return detail::which<Expr, Alts...>::type::call(expr, state, visitor);
+ typedef typename detail::which<Expr, Alts...>::type which;
+ return which()(expr, state, visitor);
}
};
@@ -460,28 +465,31 @@
{
typedef if_ proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
: mpl::eval_if<
- typename mpl::apply_wrap3<when<_, If>, Expr, State, Visitor>::type
- , mpl::apply_wrap3<when<_, Then>, Expr, State, Visitor>
- , mpl::apply_wrap3<when<_, Else>, Expr, State, Visitor>
+ typename boost::result_of<when<_, If>(Expr, State, Visitor)>::type
+ , boost::result_of<when<_, Then>(Expr, State, Visitor)>
+ , boost::result_of<when<_, Else>(Expr, State, Visitor)>
>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<if_(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
typedef
typename mpl::if_<
- typename mpl::apply_wrap3<when<_, If>, Expr, State, Visitor>::type
+ typename boost::result_of<when<_, If>(Expr, State, Visitor)>::type
, when<_, Then>
, when<_, Else>
>::type
branch;
- return branch::call(expr, state, visitor);
+ return branch()(expr, state, visitor);
}
};
@@ -496,16 +504,20 @@
{
typedef switch_ proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : Cases::template case_<typename Expr::proto_tag>::template apply<Expr, State, Visitor>
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ : boost::result_of<typename Cases::template case_<typename Expr::proto_tag>(Expr, State, Visitor)>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<switch_(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return Cases::template case_<typename Expr::proto_tag>::call(expr, state, visitor);
+ typedef typename Cases::template case_<typename Expr::proto_tag> case_;
+ return case_()(expr, state, visitor);
}
};
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-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -349,7 +349,7 @@
};
template<typename Fun, typename... Args>
- struct bind;
+ struct call;
template<typename Trans, typename... Args>
struct apply_;
@@ -414,7 +414,7 @@
using transform::_state;
using transform::_visitor;
using transform::_arg_c;
- using transform::bind;
+ using transform::call;
using transform::fold;
using transform::always;
using transform::reverse_fold;
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-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -85,7 +85,7 @@
struct apply_args<args<G...>, args<E...>, S, V, N, N, false>
{
typedef args<
- typename G::template apply<UNCVREF(E), S, V>::type...
+ typename boost::result_of<G(UNCVREF(E), S, V)>::type...
> type;
static typename type::cons_type
@@ -100,7 +100,7 @@
{
using result_of::detail::arg_c;
typename type::cons_type that = {
- G::call(arg_c<argsns_::cons<E...>, I>::call(a), s, v)...
+ G()(arg_c<argsns_::cons<E...>, I>::call(a), s, v)...
};
return that;
}
@@ -133,22 +133,25 @@
typedef expr<Tag, args<T> > type;
typedef type proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef expr<typename Expr::proto_tag, args<
- typename T::template apply<
- typename result_of::arg_c<Expr, 0>::type, State, Visitor
+ typename boost::result_of<
+ T(typename result_of::arg_c<Expr, 0>::type, State, Visitor)
>::type
> > type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<unary_expr(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- typename apply<Expr, State, Visitor>::type that = {
- T::call(proto::arg_c<0>(expr), state, visitor)
+ typename result<unary_expr(Expr, State, Visitor)>::type that = {
+ T()(proto::arg_c<0>(expr), state, visitor)
};
return that;
}
@@ -160,22 +163,25 @@
typedef expr<Tag, args<T, U> > type;
typedef type proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef expr<typename Expr::proto_tag, args<
- typename T::template apply<typename result_of::arg_c<Expr, 0>::type, State, Visitor>::type
- , typename U::template apply<typename result_of::arg_c<Expr, 1>::type, State, Visitor>::type
+ typename boost::result_of<T(typename result_of::arg_c<Expr, 0>::type, State, Visitor)>::type
+ , typename boost::result_of<U(typename result_of::arg_c<Expr, 1>::type, State, Visitor)>::type
> > type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<binary_expr(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- typename apply<Expr, State, Visitor>::type that = {
- T::call(proto::arg_c<0>(expr), state, visitor)
- , U::call(proto::arg_c<1>(expr), state, visitor)
+ typename result<binary_expr(Expr, State, Visitor)>::type that = {
+ T()(proto::arg_c<0>(expr), state, visitor)
+ , U()(proto::arg_c<1>(expr), state, visitor)
};
return that;
}
@@ -232,19 +238,24 @@
typedef expr<Tag, args<Args...> > type;
typedef type proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef detail::apply_args<args<Args...>, typename Expr::proto_args, State, Visitor> apply_;
typedef expr<typename Expr::proto_tag, typename apply_::type> type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<nary_expr(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- typename apply<Expr, State, Visitor>::type that =
- {apply<Expr, State, Visitor>::apply_::call(expr.proto_base().proto_args_, state, visitor)};
+ typedef typename result<nary_expr(Expr, State, Visitor)>::apply_ apply_;
+ typename result<nary_expr(Expr, State, Visitor)>::type that = {
+ apply_::call(expr.proto_base().proto_args_, state, visitor)
+ };
return that;
}
};
Modified: branches/proto/v3/boost/xpressive/proto/transform.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -11,7 +11,7 @@
#include <boost/xpressive/proto/transform/apply.hpp>
#include <boost/xpressive/proto/transform/arg.hpp>
-#include <boost/xpressive/proto/transform/bind.hpp>
+#include <boost/xpressive/proto/transform/call.hpp>
#include <boost/xpressive/proto/transform/fold.hpp>
#include <boost/xpressive/proto/transform/fold_tree.hpp>
#include <boost/xpressive/proto/transform/when.hpp>
Modified: branches/proto/v3/boost/xpressive/proto/transform/apply.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/apply.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/apply.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -33,21 +33,24 @@
template<typename Trans, typename ExprTfx>
struct apply_<Trans, ExprTfx> : raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : Trans::template apply<
- typename when<_, ExprTfx>::template apply<Expr, State, Visitor>::type
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ : boost::result_of<Trans(
+ typename boost::result_of<when<_, ExprTfx>(Expr, State, Visitor)>::type
, State
, Visitor
- >
+ )>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<apply_(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return Trans::call(
- when<_, ExprTfx>::call(expr, state, visitor)
+ return Trans()(
+ when<_, ExprTfx>()(expr, state, visitor)
, state
, visitor
);
@@ -57,22 +60,25 @@
template<typename Trans, typename ExprTfx, typename StateTfx>
struct apply_<Trans, ExprTfx, StateTfx> : raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : Trans::template apply<
- typename when<_, ExprTfx>::template apply<Expr, State, Visitor>::type
- , typename when<_, StateTfx>::template apply<Expr, State, Visitor>::type
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ : boost::result_of<Trans(
+ typename boost::result_of<when<_, ExprTfx>(Expr, State, Visitor)>::type
+ , typename boost::result_of<when<_, StateTfx>(Expr, State, Visitor)>::type
, Visitor
- >
+ )>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<apply_(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return Trans::call(
- when<_, ExprTfx>::call(expr, state, visitor)
- , when<_, StateTfx>::call(expr, state, visitor)
+ return Trans()(
+ when<_, ExprTfx>()(expr, state, visitor)
+ , when<_, StateTfx>()(expr, state, visitor)
, visitor
);
}
@@ -81,24 +87,27 @@
template<typename Trans, typename ExprTfx, typename StateTfx, typename VisitorTfx>
struct apply_<Trans, ExprTfx, StateTfx, VisitorTfx> : raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : Trans::template apply<
- typename when<_, ExprTfx>::template apply<Expr, State, Visitor>::type
- , typename when<_, StateTfx>::template apply<Expr, State, Visitor>::type
- , typename when<_, VisitorTfx>::template apply<Expr, State, Visitor>::type
- >
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
+ : boost::result_of<Trans(
+ typename boost::result_of<when<_, ExprTfx>(Expr, State, Visitor)>::type
+ , typename boost::result_of<when<_, StateTfx>(Expr, State, Visitor)>::type
+ , typename boost::result_of<when<_, VisitorTfx>(Expr, State, Visitor)>::type
+ )>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<apply_(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- typedef typename when<_, VisitorTfx>::template apply<Expr, State, Visitor>::type visitor_type;
- return Trans::call(
- when<_, ExprTfx>::call(expr, state, visitor)
- , when<_, StateTfx>::call(expr, state, visitor)
- , const_cast<visitor_type &>(as_lvalue(when<_, VisitorTfx>::call(expr, state, visitor)))
+ typedef typename boost::result_of<when<_, VisitorTfx>(Expr, State, Visitor)>::type visitor_type;
+ return Trans()(
+ when<_, ExprTfx>()(expr, state, visitor)
+ , when<_, StateTfx>()(expr, state, visitor)
+ , const_cast<visitor_type &>(as_lvalue(when<_, VisitorTfx>()(expr, state, visitor)))
);
}
};
Modified: branches/proto/v3/boost/xpressive/proto/transform/arg.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/arg.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/arg.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -20,15 +20,18 @@
struct _expr : raw_transform
{
- template<typename Expr, typename, typename>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef Expr type;
};
template<typename Expr, typename State, typename Visitor>
- static Expr const &
- call(Expr const &expr, State const &, Visitor &)
+ Expr const &
+ operator()(Expr const &expr, State const &, Visitor &) const
{
return expr;
}
@@ -36,15 +39,18 @@
struct _state : raw_transform
{
- template<typename, typename State, typename>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef State type;
};
template<typename Expr, typename State, typename Visitor>
- static State const &
- call(Expr const &, State const &state, Visitor &)
+ State const &
+ operator()(Expr const &, State const &state, Visitor &) const
{
return state;
}
@@ -52,15 +58,18 @@
struct _visitor : raw_transform
{
- template<typename, typename, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef Visitor type;
};
template<typename Expr, typename State, typename Visitor>
- static Visitor &
- call(Expr const &, State const &, Visitor &visitor)
+ Visitor &
+ operator()(Expr const &, State const &, Visitor &visitor) const
{
return visitor;
}
@@ -69,14 +78,17 @@
template<int I>
struct _arg_c : raw_transform
{
- template<typename Expr, typename, typename>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
: proto::result_of::arg_c<Expr, I>
{};
template<typename Expr, typename State, typename Visitor>
- static typename boost::proto::result_of::arg_c<Expr, I>::const_reference
- call(Expr const &expr, State const &, Visitor &)
+ typename boost::proto::result_of::arg_c<Expr, I>::const_reference
+ operator()(Expr const &expr, State const &, Visitor &) const
{
return proto::arg_c<I>(expr);
}
@@ -100,14 +112,17 @@
template<typename T>
struct always : raw_transform
{
- template<typename, typename, typename>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef T type;
};
template<typename Expr, typename State, typename Visitor>
- static T call(Expr const &, State const &, Visitor &)
+ T operator()(Expr const &, State const &, Visitor &) const
{
return T();
}
Deleted: branches/proto/v3/boost/xpressive/proto/transform/bind.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/bind.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
+++ (empty file)
@@ -1,61 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-/// \file bind.hpp
-/// Contains definition of the bind<> transform.
-//
-// Copyright 2007 Eric Niebler. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_PROTO_TRANSFORM_BIND_HPP_EAN_11_02_2007
-#define BOOST_PROTO_TRANSFORM_BIND_HPP_EAN_11_02_2007
-
-#include <boost/utility/result_of.hpp>
-#include <boost/xpressive/proto/proto_fwd.hpp>
-#include <boost/xpressive/proto/traits.hpp>
-
-namespace boost { namespace proto
-{
-
- namespace transform
- {
-
- template<typename Fun, typename... Args>
- struct bind : raw_transform
- {
- template<typename Expr, typename State, typename Visitor>
- struct apply
- : boost::result_of<
- Fun(typename when<_, Args>::template apply<Expr, State, Visitor>::type...)
- >
- {};
-
- template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
- {
- Fun f;
- return f(when<_, Args>::call(expr, state, visitor)...);
- }
- };
-
- template<typename Fun>
- struct bind<Fun> : Fun, function_transform
- {};
-
- }
-
- template<typename Fun>
- struct transform_category<transform::bind<Fun> >
- {
- typedef function_transform type;
- };
-
- template<typename Fun, typename... Args>
- struct transform_category<transform::bind<Fun, Args...> >
- {
- typedef raw_transform type;
- };
-
-}}
-
-#endif
Copied: branches/proto/v3/boost/xpressive/proto/transform/call.hpp (from r41525, /branches/proto/v3/boost/xpressive/proto/transform/bind.hpp)
==============================================================================
--- /branches/proto/v3/boost/xpressive/proto/transform/bind.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/call.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -1,13 +1,13 @@
///////////////////////////////////////////////////////////////////////////////
-/// \file bind.hpp
-/// Contains definition of the bind<> transform.
+/// \file call.hpp
+/// Contains definition of the call<> transform.
//
// Copyright 2007 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_PROTO_TRANSFORM_BIND_HPP_EAN_11_02_2007
-#define BOOST_PROTO_TRANSFORM_BIND_HPP_EAN_11_02_2007
+#ifndef BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
+#define BOOST_PROTO_TRANSFORM_CALL_HPP_EAN_11_02_2007
#include <boost/utility/result_of.hpp>
#include <boost/xpressive/proto/proto_fwd.hpp>
@@ -20,38 +20,36 @@
{
template<typename Fun, typename... Args>
- struct bind : raw_transform
+ struct call : raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
: boost::result_of<
- Fun(typename when<_, Args>::template apply<Expr, State, Visitor>::type...)
+ Fun(typename boost::result_of<when<_, Args>(Expr, State, Visitor)>::type...)
>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<call(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
Fun f;
- return f(when<_, Args>::call(expr, state, visitor)...);
+ return f(when<_, Args>()(expr, state, visitor)...);
}
};
- template<typename Fun>
- struct bind<Fun> : Fun, function_transform
+ template<typename Fun, typename... Args>
+ struct call<Fun(Args...)>
+ : call<Fun, Args...>
{};
}
- template<typename Fun>
- struct transform_category<transform::bind<Fun> >
- {
- typedef function_transform type;
- };
-
template<typename Fun, typename... Args>
- struct transform_category<transform::bind<Fun, Args...> >
+ struct transform_category<transform::call<Fun, Args...> >
{
typedef raw_transform type;
};
Modified: branches/proto/v3/boost/xpressive/proto/transform/fold.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/fold.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/fold.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -44,14 +44,14 @@
template<typename This, typename Expr, typename State>
struct result<This(Expr, State)>
- : Tfx::template apply<UNCVREF(Expr), UNCVREF(State), Visitor>
+ : boost::result_of<Tfx(UNCVREF(Expr), UNCVREF(State), Visitor)>
{};
template<typename Expr, typename State>
- typename Tfx::template apply<Expr, State, Visitor>::type
+ typename boost::result_of<Tfx(Expr, State, Visitor)>::type
operator()(Expr const &expr, State const &state) const
{
- return Tfx::call(expr, state, this->v_);
+ return Tfx()(expr, state, this->v_);
}
private:
@@ -80,23 +80,26 @@
template<typename Sequence, typename State0, typename Fun>
struct fold : raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
: fusion::result_of::fold<
- typename when<_, Sequence>::template apply<Expr, State, Visitor>::type
- , typename when<_, State0>::template apply<Expr, State, Visitor>::type
+ typename boost::result_of<when<_, Sequence>(Expr, State, Visitor)>::type
+ , typename boost::result_of<when<_, State0>(Expr, State, Visitor)>::type
, detail::as_callable<Fun, Visitor>
>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<fold(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
detail::as_callable<Fun, Visitor> fun(visitor);
return fusion::fold(
- when<_, Sequence>::call(expr, state, visitor)
- , when<_, State0>::call(expr, state, visitor)
+ when<_, Sequence>()(expr, state, visitor)
+ , when<_, State0>()(expr, state, visitor)
, fun
);
}
Modified: branches/proto/v3/boost/xpressive/proto/transform/fold_tree.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/fold_tree.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/fold_tree.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -46,8 +46,11 @@
struct fold_tree
: raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef fold<
Sequence
@@ -58,14 +61,15 @@
>
> impl;
- typedef typename impl::template apply<Expr, State, Visitor>::type type;
+ typedef typename boost::result_of<impl(Expr, State, Visitor)>::type type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<fold_tree(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return apply<Expr, State, Visitor>::impl::call(expr, state, visitor);
+ typedef typename result<fold_tree(Expr, State, Visitor)>::impl impl;
+ return impl()(expr, state, visitor);
}
};
@@ -73,8 +77,11 @@
struct reverse_fold_tree
: raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
{
typedef reverse_fold<
Sequence
@@ -85,14 +92,15 @@
>
> impl;
- typedef typename impl::template apply<Expr, State, Visitor>::type type;
+ typedef typename boost::result_of<impl(Expr, State, Visitor)>::type type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<reverse_fold_tree(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return apply<Expr, State, Visitor>::impl::call(expr, state, visitor);
+ typedef typename result<reverse_fold_tree(Expr, State, Visitor)>::impl impl;
+ return impl()(expr, state, visitor);
}
};
}
Modified: branches/proto/v3/boost/xpressive/proto/transform/when.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/transform/when.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto/transform/when.hpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -17,7 +17,7 @@
#include <boost/type_traits.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/xpressive/proto/proto_fwd.hpp>
-#include <boost/xpressive/proto/transform/bind.hpp>
+#include <boost/xpressive/proto/transform/call.hpp>
#include <boost/xpressive/proto/transform/apply.hpp>
namespace boost { namespace proto
@@ -137,17 +137,17 @@
template<typename R, typename Expr, typename State, typename Visitor>
struct apply_lambda_<R, Expr, State, Visitor, raw_transform>
- : R::template apply<Expr, State, Visitor>
+ : boost::result_of<R(Expr, State, Visitor)>
{};
template<typename R, typename... Args, typename Expr, typename State, typename Visitor>
struct apply_lambda_<R(Args...), Expr, State, Visitor, no_transform>
- : when<_, R(Args...)>::template apply<Expr, State, Visitor>
+ : boost::result_of<when<_, R(Args...)>(Expr, State, Visitor)>
{};
template<typename R, typename... Args, typename Expr, typename State, typename Visitor>
struct apply_lambda_<R(*)(Args...), Expr, State, Visitor, no_transform>
- : when<_, R(*)(Args...)>::template apply<Expr, State, Visitor>
+ : boost::result_of<when<_, R(*)(Args...)>(Expr, State, Visitor)>
{};
// work around GCC bug
@@ -212,7 +212,7 @@
static type call_(Expr const &expr, State const &state, Visitor &visitor, mpl::true_)
{
return detail::construct_<type>(
- when<_, Args>::call(expr, state, visitor)...
+ when<_, Args>()(expr, state, visitor)...
);
}
@@ -231,11 +231,13 @@
>
struct apply_<Expr, State, Visitor, function_transform, Return, Args...>
{
- typedef typename bind<Return, Args...>::template apply<Expr, State, Visitor>::type type;
+ typedef typename boost::result_of<
+ transform::call<Return, Args...>(Expr, State, Visitor)
+ >::type type;
static type call(Expr const &expr, State const &state, Visitor &visitor)
{
- return bind<Return, Args...>::call(expr, state, visitor);
+ return transform::call<Return, Args...>()(expr, state, visitor);
}
};
@@ -248,11 +250,13 @@
>
struct apply_<Expr, State, Visitor, raw_transform, Return, Args...>
{
- typedef typename transform::apply_<Return, Args...>::template apply<Expr, State, Visitor>::type type;
+ typedef typename boost::result_of<
+ transform::apply_<Return, Args...>(Expr, State, Visitor)
+ >::type type;
static type call(Expr const &expr, State const &state, Visitor &visitor)
{
- return transform::apply_<Return, Args...>::call(expr, state, visitor);
+ return transform::apply_<Return, Args...>()(expr, state, visitor);
}
};
@@ -276,17 +280,20 @@
{
typedef typename Grammar::proto_base_expr proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
: detail::apply_<Expr, State, Visitor, typename transform_category<Return>::type, Return, Args...>
{};
// BUGBUG makes a temporary
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<when(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return apply<Expr, State, Visitor>::call(expr, state, visitor);
+ return result<when(Expr, State, Visitor)>::call(expr, state, visitor);
}
};
@@ -296,16 +303,19 @@
{
typedef typename Grammar::proto_base_expr proto_base_expr;
- template<typename Expr, typename State, typename Visitor>
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ struct result<This(Expr, State, Visitor)>
: detail::apply_<Expr, State, Visitor, typename transform_category<Return>::type, Return, Args...>
{};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- call(Expr const &expr, State const &state, Visitor &visitor)
+ typename result<when(Expr, State, Visitor)>::type
+ operator()(Expr const &expr, State const &state, Visitor &visitor) const
{
- return apply<Expr, State, Visitor>::call(expr, state, visitor);
+ return result<when(Expr, State, Visitor)>::call(expr, state, visitor);
}
};
Modified: branches/proto/v3/libs/xpressive/proto/example/mixed.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/example/mixed.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/example/mixed.cpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -247,7 +247,7 @@
int i = 0;
IncrementCtx const inc = {};
DereferenceCtx const deref = {};
- typename Begin::apply<Expr, int, int>::type expr2 = Begin::call(expr, i, i);
+ typename boost::result_of<Begin(Expr, int, int)>::type expr2 = Begin()(expr, i, i);
for(; begin != end; ++begin)
{
op(*begin, proto::eval(expr2, deref));
Modified: branches/proto/v3/libs/xpressive/proto/example/rgb.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/example/rgb.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/example/rgb.cpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -88,7 +88,7 @@
void printColor(Expr const & expr)
{
int i = 0; // dummy state and visitor parameter, not used
- std::cout << RGB::call(expr, i, i) << std::endl;
+ std::cout << RGB()(expr, i, i) << std::endl;
}
int main()
Modified: branches/proto/v3/libs/xpressive/proto/example/vec3.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/example/vec3.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/example/vec3.cpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -135,7 +135,7 @@
// This is another way to count the leaves using a transform.
int i = 0;
- assert( CountLeaves::call(expr, i, i) == ctx.count );
+ assert( CountLeaves()(expr, i, i) == ctx.count );
return ctx.count;
}
Modified: branches/proto/v3/libs/xpressive/proto/test/examples.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/test/examples.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/test/examples.cpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -60,32 +60,35 @@
// calculator expression by finding the arity of the
// child expression.
struct unary_arity
- /*<< All custom transforms should inherit from
- transform_base. In some cases, (e.g., when the transform
+ /*<< Custom transforms should inherit from
+ raw_transform. In some cases, (e.g., when the transform
is a template), it is also necessary to specialize
- the proto::is_transform<> trait. >>*/
+ the proto::transform_category<> trait. >>*/
: raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- /*<< Transforms have a nested `apply<>` for calculating their return type. >>*/
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ /*<< Transforms have a nested `result<>` for calculating their return type. >>*/
+ struct result<This(Expr, State, Visitor)>
{
/*<< Get the child. >>*/
typedef typename result_of::arg<Expr>::type child_expr;
/*<< Apply `CalculatorArity` to find the arity of the child. >>*/
- typedef typename mpl::apply_wrap3<CalculatorArity, child_expr, State, Visitor>::type type;
+ typedef typename boost::result_of<CalculatorArity(child_expr, State, Visitor)>::type type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
- /*<< Transforms have a nested `call()` member function. >>*/
- call(Expr const &, State const &, Visitor &)
+ typename result<unary_arity(Expr, State, Visitor)>::type
+ /*<< Transforms have a nested `operator()` member function. >>*/
+ operator()(Expr const &, State const &, Visitor &) const
{
/*<< The `unary_arity` transform doesn't have an interesting
runtime counterpart, so just return a default-constructed object
of the correct type. >>*/
- return typename apply<Expr, State, Visitor>::type();
+ return typename result<unary_arity(Expr, State, Visitor)>::type();
}
};
@@ -99,31 +102,34 @@
the proto::is_transform<> trait. >>*/
: raw_transform
{
- template<typename Expr, typename State, typename Visitor>
- /*<< Transforms have a nested `apply<>` for calculating their return type. >>*/
- struct apply
+ template<typename Sig>
+ struct result;
+
+ template<typename This, typename Expr, typename State, typename Visitor>
+ /*<< Transforms have a nested `result<>` for calculating their return type. >>*/
+ struct result<This(Expr, State, Visitor)>
{
/*<< Get the left and right children. >>*/
typedef typename result_of::left<Expr>::type left_expr;
typedef typename result_of::right<Expr>::type right_expr;
/*<< Apply `CalculatorArity` to find the arity of the left and right children. >>*/
- typedef typename mpl::apply_wrap3<CalculatorArity, left_expr, State, Visitor>::type left_arity;
- typedef typename mpl::apply_wrap3<CalculatorArity, right_expr, State, Visitor>::type right_arity;
+ typedef typename boost::result_of<CalculatorArity(left_expr, State, Visitor)>::type left_arity;
+ typedef typename boost::result_of<CalculatorArity(right_expr, State, Visitor)>::type right_arity;
/*<< The return type is the maximum of the children's arities. >>*/
typedef typename mpl::max<left_arity, right_arity>::type type;
};
template<typename Expr, typename State, typename Visitor>
- static typename apply<Expr, State, Visitor>::type
+ typename result<binary_arity(Expr, State, Visitor)>::type
/*<< Transforms have a nested `call()` member function. >>*/
- call(Expr const &, State const &, Visitor &)
+ operator()(Expr const &, State const &, Visitor &) const
{
/*<< The `binary_arity` transform doesn't have an interesting
runtime counterpart, so just return a default-constructed object
of the correct type. >>*/
- return typename apply<Expr, State, Visitor>::type();
+ return typename result<binary_arity(Expr, State, Visitor)>::type();
}
};
//]
@@ -272,27 +278,27 @@
//[ CalculatorArityTest
int i = 0; // not used, dummy state and visitor parameter
- std::cout << CalculatorArity::call( lit(100) * 200, i, i) << '\n';
- std::cout << CalculatorArity::call( (_1 - _1) / _1 * 100, i, i) << '\n';
- std::cout << CalculatorArity::call( (_2 - _1) / _2 * 100, i, i) << '\n';
+ std::cout << CalculatorArity()( lit(100) * 200, i, i) << '\n';
+ std::cout << CalculatorArity()( (_1 - _1) / _1 * 100, i, i) << '\n';
+ std::cout << CalculatorArity()( (_2 - _1) / _2 * 100, i, i) << '\n';
//]
- BOOST_CHECK_EQUAL(0, CalculatorArity::call( lit(100) * 200, i, i));
- BOOST_CHECK_EQUAL(1, CalculatorArity::call( (_1 - _1) / _1 * 100, i, i));
- BOOST_CHECK_EQUAL(2, CalculatorArity::call( (_2 - _1) / _2 * 100, i, i));
-
- BOOST_CHECK_EQUAL(0, CalcArity2::call( lit(100) * 200, i, i));
- BOOST_CHECK_EQUAL(1, CalcArity2::call( (_1 - _1) / _1 * 100, i, i));
- BOOST_CHECK_EQUAL(2, CalcArity2::call( (_2 - _1) / _2 * 100, i, i));
+ BOOST_CHECK_EQUAL(0, CalculatorArity()( lit(100) * 200, i, i));
+ BOOST_CHECK_EQUAL(1, CalculatorArity()( (_1 - _1) / _1 * 100, i, i));
+ BOOST_CHECK_EQUAL(2, CalculatorArity()( (_2 - _1) / _2 * 100, i, i));
+
+ BOOST_CHECK_EQUAL(0, CalcArity2()( lit(100) * 200, i, i));
+ BOOST_CHECK_EQUAL(1, CalcArity2()( (_1 - _1) / _1 * 100, i, i));
+ BOOST_CHECK_EQUAL(2, CalcArity2()( (_2 - _1) / _2 * 100, i, i));
using boost::fusion::cons;
using boost::fusion::nil;
- cons<int, cons<char, cons<std::string> > > args(ArgsAsList::call( _1(1, 'a', std::string("b")), i, i ));
+ cons<int, cons<char, cons<std::string> > > args(ArgsAsList()( _1(1, 'a', std::string("b")), i, i ));
BOOST_CHECK_EQUAL(args.car, 1);
BOOST_CHECK_EQUAL(args.cdr.car, 'a');
BOOST_CHECK_EQUAL(args.cdr.cdr.car, std::string("b"));
- cons<int, cons<char, cons<std::string> > > lst(FoldTreeToList::call( (_1 = 1, 'a', std::string("b")), i, i ));
+ cons<int, cons<char, cons<std::string> > > lst(FoldTreeToList()( (_1 = 1, 'a', std::string("b")), i, i ));
BOOST_CHECK_EQUAL(lst.car, 1);
BOOST_CHECK_EQUAL(lst.cdr.car, 'a');
BOOST_CHECK_EQUAL(lst.cdr.cdr.car, std::string("b"));
@@ -300,12 +306,12 @@
plus<
terminal<double>::type
, terminal<double>::type
- >::type p = Promote::call( lit(1.f) + 2.f, i, i );
+ >::type p = Promote()( lit(1.f) + 2.f, i, i );
//[ LazyMakePairTest
int j = 0; // not used, dummy state and visitor parameter
- std::pair<int, double> p2 = MakePair::call( make_pair_(1, 3.14), j, j );
+ std::pair<int, double> p2 = MakePair()( make_pair_(1, 3.14), j, j );
std::cout << p2.first << std::endl;
std::cout << p2.second << std::endl;
@@ -314,9 +320,9 @@
BOOST_CHECK_EQUAL(p2.first, 1);
BOOST_CHECK_EQUAL(p2.second, 3.14);
- NegateInt::call(lit(1), i, i);
+ NegateInt()(lit(1), i, i);
#ifndef BOOST_MSVC
- SquareAndPromoteInt::call(lit(1), i, i);
+ SquareAndPromoteInt()(lit(1), i, i);
#endif
}
Modified: branches/proto/v3/libs/xpressive/proto/test/lambda.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/test/lambda.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/test/lambda.cpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -73,7 +73,7 @@
// simple wrapper for calculating a lambda expression's arity.
template<typename Expr>
struct lambda_arity
- : grammar::Lambda::apply<Expr, mpl::void_, mpl::void_>
+ : boost::result_of<grammar::Lambda(Expr, mpl::void_, mpl::void_)>
{};
// The lambda context is the same as the default context
Modified: branches/proto/v3/libs/xpressive/proto/test/main.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/test/main.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/test/main.cpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -270,33 +270,33 @@
terminal<float>::type ff = {1.F};
check<Promote>(ff+ff);
plus<terminal<double>::type, terminal<double>::type>::type dd =
- Promote::call(ff+ff, dummy, non_);
+ Promote()(ff+ff, dummy, non_);
plus<terminal<double>::type, terminal<int>::type>::type du =
- Promote::call(ff+u, dummy, non_);
+ Promote()(ff+u, dummy, non_);
std::printf("%g %d\n", arg_c<0>(arg_c<0>(du)), arg_c<0>(arg_c<1>(du)));
plus<negate<terminal<double>::type>::type, terminal<int>::type>::type ndu =
- Promote::call(+ff+u, dummy, non_);
+ Promote()(+ff+u, dummy, non_);
std::printf("%g %d\n", arg_c<0>(arg_c<0>(arg_c<0>(ndu))), arg_c<0>(arg_c<1>(ndu)));
terminal<char const *>::type sz = {"hello"};
- std::string str = Promote::call(sz, dummy, non_);
+ std::string str = Promote()(sz, dummy, non_);
std::printf(
"%d %d %d\n"
- , (int)Arity::call(sz, dummy, non_)
- , (int)Arity::call(_1 + 0, dummy, non_)
- , (int)Arity::call(_2 + _1, dummy, non_)
+ , (int)Arity()(sz, dummy, non_)
+ , (int)Arity()(_1 + 0, dummy, non_)
+ , (int)Arity()(_2 + _1, dummy, non_)
);
using fusion::cons;
cons<char, cons<int, cons<float> > > mylist1 =
- ArgsAsList::call(_1('a', 42, 3.14f), dummy, non_);
+ ArgsAsList()(_1('a', 42, 3.14f), dummy, non_);
std::cout << mylist1.car << ' ' << mylist1.cdr.car << ' ' << mylist1.cdr.cdr.car << std::endl;
cons<int, cons<char, cons<std::string> > > mylist2
- (FoldTreeToList::call( (_1 = 1, 'a', str), dummy, non_ ));
+ (FoldTreeToList()( (_1 = 1, 'a', str), dummy, non_ ));
std::cout << mylist2.car << ' ' << mylist2.cdr.car << ' ' << mylist2.cdr.cdr.car << std::endl;
default_context ctx;
Modified: branches/proto/v3/libs/xpressive/proto/test/toy_spirit.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/test/toy_spirit.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto/test/toy_spirit.cpp 2007-12-01 20:24:09 EST (Sat, 01 Dec 2007)
@@ -375,7 +375,7 @@
{
mpl::false_ is_case_sensitive;
parser<Iterator> parse_fun(begin, end);
- return parse_fun(SpiritExpr::call(rule, 0, is_case_sensitive));
+ return parse_fun(SpiritExpr()(rule, 0, is_case_sensitive));
}
// 2nd overload provides a short error message for invalid rules
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