Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-11-11 18:16:40


Author: eric_niebler
Date: 2007-11-11 18:16:39 EST (Sun, 11 Nov 2007)
New Revision: 41020
URL: http://svn.boost.org/trac/boost/changeset/41020

Log:
get mixed.cpp example working again
Text files modified:
   branches/proto/v3/boost/xpressive/proto3/context/null.hpp | 4
   branches/proto/v3/boost/xpressive/proto3/operators.hpp | 159 +++++++++++++++++++++++++
   branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp | 4
   branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp | 50 ++++----
   branches/proto/v3/libs/xpressive/proto3/test/main.cpp | 244 +++++++++++++++++++--------------------
   5 files changed, 304 insertions(+), 157 deletions(-)

Modified: branches/proto/v3/boost/xpressive/proto3/context/null.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/context/null.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/context/null.hpp 2007-11-11 18:16:39 EST (Sun, 11 Nov 2007)
@@ -35,8 +35,8 @@
             static void call_(argsns_::cons<> const &, Context &)
             {}
 
- template<typename... Args>
- static void call_(argsns_::cons<Args...> const &args, Context &ctx)
+ template<typename Cons>
+ static void call_(Cons &args, Context &ctx)
             {
                 proto::eval(args.car, ctx);
                 call_(args.cdr, ctx);

Modified: branches/proto/v3/boost/xpressive/proto3/operators.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/operators.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/operators.hpp 2007-11-11 18:16:39 EST (Sun, 11 Nov 2007)
@@ -75,13 +75,83 @@
                 typedef default_domain type;
             };
 
+ template<typename Arg, typename Trait, typename Enable = void>
+ struct arg_weight
+ {
+ BOOST_STATIC_CONSTANT(int, value = 1 + Trait::value);
+ };
+
+ template<typename Arg, typename Trait>
+ struct arg_weight<Arg, Trait, typename Arg::proto_is_expr_>
+ {
+ BOOST_STATIC_CONSTANT(int, value = 0);
+ };
+
+ template<typename Arg, typename Trait>
+ struct arg_weight<Arg &, Trait, typename Arg::proto_is_expr_>
+ {
+ BOOST_STATIC_CONSTANT(int, value = 0);
+ };
+
+ template<typename Domain, typename Trait, typename Arg, typename Expr>
+ struct enable_unary
+ : boost::enable_if<
+ boost::mpl::and_<Trait, boost::proto::matches<Expr, typename Domain::grammar> >
+ , Expr
+ >
+ {};
+
+ template<typename Trait, typename Arg, typename Expr>
+ struct enable_unary<deduce_domain, Trait, Arg, Expr>
+ : boost::enable_if<
+ boost::mpl::and_<
+ Trait
+ , boost::proto::matches<Expr, typename domain_of<Arg>::type::grammar>
+ >
+ , Expr
+ >
+ {};
+
+ template<typename Trait, typename Arg, typename Expr>
+ struct enable_unary<default_domain, Trait, Arg, Expr>
+ : boost::enable_if<Trait, Expr>
+ {};
+
+ template<typename Domain, typename Trait1, typename Arg1, typename Trait2, typename Arg2, typename Expr>
+ struct enable_binary
+ : boost::enable_if<
+ boost::mpl::and_<
+ mpl::bool_<(3 <= (arg_weight<Arg1, Trait1>::value + arg_weight<Arg2, Trait2>::value))>
+ , boost::proto::matches<Expr, typename Domain::grammar>
+ >
+ , Expr
+ >
+ {};
+
+ template<typename Trait1, typename Arg1, typename Trait2, typename Arg2, typename Expr>
+ struct enable_binary<deduce_domain, Trait1, Arg1, Trait2, Arg2, Expr>
+ : boost::enable_if<
+ boost::mpl::and_<
+ mpl::bool_<(3 <= (arg_weight<Arg1, Trait1>::value + arg_weight<Arg2, Trait2>::value))>
+ , boost::proto::matches<Expr, typename unify_domain<Arg1, Arg2>::type::grammar>
+ >
+ , Expr
+ >
+ {};
+
+ template<typename Trait1, typename Arg1, typename Trait2, typename Arg2, typename Expr>
+ struct enable_binary<default_domain, Trait1, Arg1, Trait2, Arg2, Expr>
+ : boost::enable_if_c<
+ (3 <= (arg_weight<Arg1, Trait1>::value + arg_weight<Arg2, Trait2>::value))
+ , Expr
+ >
+ {};
+
         }
 
     #define BOOST_PROTO_UNARY_OP_IS_POSTFIX_0
     #define BOOST_PROTO_UNARY_OP_IS_POSTFIX_1 , int
 
- // BUGBUG these are borken because of gcc bug wrt forwarding
- // of built-in temporaries
     #define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, POST) \
         template<typename A> \
         typename detail::generate_if< \
@@ -168,9 +238,6 @@
         BOOST_PROTO_DEFINE_BINARY_OPERATOR(|=, tag::bitwise_or_assign)
         BOOST_PROTO_DEFINE_BINARY_OPERATOR(^=, tag::bitwise_xor_assign)
 
- #undef BOOST_PROTO_UNARY_OP_IS_POSTFIX_0
- #undef BOOST_PROTO_UNARY_OP_IS_POSTFIX_1
-
     #undef BOOST_PROTO_DEFINE_UNARY_OPERATOR
     #undef BOOST_PROTO_DEFINE_BINARY_OPERATOR
 
@@ -184,6 +251,88 @@
     
     using exprns_::if_else;
 
+#define BOOST_PROTO_DEFINE_UNARY_OPERATOR(OP, TAG, TRAIT, DOMAIN, POST) \
+ template<typename Arg> \
+ typename boost::proto::exprns_::detail::enable_unary< \
+ DOMAIN \
+ , TRAIT<BOOST_PROTO_UNCVREF(Arg)>, Arg \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Arg>::type \
+ >::type \
+ operator OP(Arg &&arg BOOST_PROTO_UNARY_OP_IS_POSTFIX_ ## POST) \
+ { \
+ return boost::proto::result_of::make_expr<TAG, DOMAIN, Arg>::call(arg); \
+ } \
+ /**/
+
+#define BOOST_PROTO_DEFINE_BINARY_OPERATOR(OP, TAG, TRAIT, DOMAIN) \
+ template<typename Left, typename Right> \
+ typename boost::proto::exprns_::detail::enable_binary< \
+ DOMAIN \
+ , TRAIT<BOOST_PROTO_UNCVREF(Left)>, Left \
+ , TRAIT<BOOST_PROTO_UNCVREF(Right)>, Right \
+ , typename boost::proto::result_of::make_expr<TAG, DOMAIN, Left, Right>::type \
+ >::type const \
+ operator OP(Left &&left, Right &&right) \
+ { \
+ return boost::proto::result_of::make_expr<TAG, DOMAIN, Left, Right> \
+ ::call(left, right); \
+ } \
+ /**/
+
+#define BOOST_PROTO_DEFINE_OPERATORS(TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(+, boost::proto::tag::posit, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(-, boost::proto::tag::negate, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(*, boost::proto::tag::dereference, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(~, boost::proto::tag::complement, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(&, boost::proto::tag::address_of, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(!, boost::proto::tag::logical_not, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, boost::proto::tag::pre_inc, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, boost::proto::tag::pre_dec, TRAIT, DOMAIN, 0) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(++, boost::proto::tag::post_inc, TRAIT, DOMAIN, 1) \
+ BOOST_PROTO_DEFINE_UNARY_OPERATOR(--, boost::proto::tag::post_dec, TRAIT, DOMAIN, 1) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<, boost::proto::tag::shift_left, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>, boost::proto::tag::shift_right, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*, boost::proto::tag::multiplies, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/, boost::proto::tag::divides, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%, boost::proto::tag::modulus, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+, boost::proto::tag::plus, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-, boost::proto::tag::minus, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<, boost::proto::tag::less, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>, boost::proto::tag::greater, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<=, boost::proto::tag::less_equal, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>=, boost::proto::tag::greater_equal, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(==, boost::proto::tag::equal_to, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(!=, boost::proto::tag::not_equal_to, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(||, boost::proto::tag::logical_or, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&&, boost::proto::tag::logical_and, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&, boost::proto::tag::bitwise_and, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|, boost::proto::tag::bitwise_or, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^, boost::proto::tag::bitwise_xor, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(BOOST_PP_COMMA(), boost::proto::tag::comma, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(->*, boost::proto::tag::mem_ptr, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(<<=, boost::proto::tag::shift_left_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(>>=, boost::proto::tag::shift_right_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(*=, boost::proto::tag::multiplies_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(/=, boost::proto::tag::divides_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(%=, boost::proto::tag::modulus_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(+=, boost::proto::tag::plus_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(-=, boost::proto::tag::minus_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(&=, boost::proto::tag::bitwise_and_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(|=, boost::proto::tag::bitwise_or_assign, TRAIT, DOMAIN) \
+ BOOST_PROTO_DEFINE_BINARY_OPERATOR(^=, boost::proto::tag::bitwise_xor_assign, TRAIT, DOMAIN) \
+ /**/
+
+ template<typename T>
+ struct is_extension
+ : mpl::false_
+ {};
+
+ namespace exops
+ {
+ BOOST_PROTO_DEFINE_OPERATORS(is_extension, default_domain)
+ using proto::if_else;
+ }
+
 }}
 
 #undef UNREF

Modified: branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp (original)
+++ branches/proto/v3/boost/xpressive/proto3/proto_fwd.hpp 2007-11-11 18:16:39 EST (Sun, 11 Nov 2007)
@@ -10,6 +10,7 @@
 #define BOOST_PROTO3_PROTO_FWD_EAN_10_28_2007
 
 #include <climits> // for INT_MAX
+#include <boost/type_traits.hpp>
 
 namespace boost { namespace proto
 {
@@ -449,4 +450,7 @@
     {}
 }}
 
+#define BOOST_PROTO_UNCVREF(x)\
+ typename boost::remove_cv<typename boost::remove_reference<x>::type>::type
+
 #endif

Modified: branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/example/mixed.cpp 2007-11-11 18:16:39 EST (Sun, 11 Nov 2007)
@@ -16,7 +16,7 @@
 #include <iostream>
 #include <stdexcept>
 #include <boost/xpressive/proto3/proto.hpp>
-//#include <boost/xpressive/proto3/debug.hpp>
+#include <boost/xpressive/proto3/debug.hpp>
 #include <boost/xpressive/proto3/context.hpp>
 #include <boost/typeof/std/list.hpp>
 #include <boost/typeof/std/vector.hpp>
@@ -74,7 +74,7 @@
       : proto::result_of::as_expr<iterator_wrapper<typename Cont::const_iterator> >
     {};
     template<typename Cont>
- typename proto::as_expr<iterator_wrapper<typename Cont::const_iterator> >::type
+ typename proto::result_of::as_expr<iterator_wrapper<typename Cont::const_iterator> >::type
     operator()(Cont const &cont) const
     {
         iterator_wrapper<typename Cont::const_iterator> it(cont.begin());
@@ -245,28 +245,28 @@
         }
     };
 
- struct sin_
- {
- template<typename Sig> struct result {};
- template<typename This, typename Arg>
- struct result<This(Arg)>
- : remove_const<typename remove_reference<Arg>::type>
- {};
-
- template<typename Arg>
- Arg operator()(Arg const &arg) const
- {
- return std::sin(arg);
- }
- };
-
- BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
- 1
- , sin
- , MixedDomain
- , (boost::proto::tag::function)
- , ((sin_))
- )
+ //struct sin_
+ //{
+ // template<typename Sig> struct result {};
+ // template<typename This, typename Arg>
+ // struct result<This(Arg)>
+ // : remove_const<typename remove_reference<Arg>::type>
+ // {};
+
+ // template<typename Arg>
+ // Arg operator()(Arg const &arg) const
+ // {
+ // return std::sin(arg);
+ // }
+ //};
+
+ //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
+ // 1
+ // , sin
+ // , MixedDomain
+ // , (boost::proto::tag::function)
+ // , ((sin_))
+ //)
 
     template<typename FwdIter, typename Expr, typename Op>
     void evaluate(FwdIter begin, FwdIter end, Expr const &expr, Op op)
@@ -358,7 +358,7 @@
     VectorOps::assign(e, c);
     e += e - 4 / (c + 1);
 
- f -= sin(0.1 * e * std::complex<double>(0.2, 1.2));
+ //f -= sin(0.1 * e * std::complex<double>(0.2, 1.2));
 
     std::list<double>::const_iterator ei = e.begin();
     std::list<std::complex<double> >::const_iterator fi = f.begin();

Modified: branches/proto/v3/libs/xpressive/proto3/test/main.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto3/test/main.cpp (original)
+++ branches/proto/v3/libs/xpressive/proto3/test/main.cpp 2007-11-11 18:16:39 EST (Sun, 11 Nov 2007)
@@ -224,14 +224,6 @@
 byvalexpr<terminal<int>::type> B;
 byvalexpr<terminal<int>::type> C;
 
-struct tmp
-{
- int i;
- tmp( tmp && that ){}
-};
-
-//tmp const tmp1 = {1};
-
 int main()
 {
     int dummy=0;
@@ -240,124 +232,126 @@
     terminal<int>::type u = {42};
     terminal<int>::type const t = {42};
 
- int j=0;
+ arg(u) = 43;
+
+ //int j=0;
 
- expr<tag::function,
- args<
- expr<tag::terminal, term<int> > const &
- , expr<tag::terminal, term<int const &> >
- , expr<tag::terminal, term<int &> >
- , expr<tag::terminal, term<int> > const &
- >
- > that = t(1,j,t);
-
- function<
- expr<tag::terminal, term<int> > const &
- , expr<tag::terminal, term<int const &> >
- , expr<tag::terminal, term<int &> >
- , expr<tag::terminal, term<int> > const &
- >::type other = t(1,j,t);
-
- expr<tag::assign,
- args<
- expr<tag::terminal, term<int> > const &
- , expr<tag::terminal, term<int const &> >
- >
- > that2 = (t = 1);
-
- expr<tag::posit,
- args<expr<tag::terminal, term<int> > const &>
- > that3 = +t;
-
- expr<tag::posit,
- args<expr<tag::terminal, term<int> > &>
- > that4 = +u;
-
- expr<tag::plus,
- args<
- expr<tag::terminal, term<int> > &
- , expr<tag::terminal, term<int &> >
- >
- > that5 = u + j;
-
- std::printf("%d %d\n", arg_c<0>(arg_c<0>(that5)), arg_c<0>(arg_c<1>(that5)));
-
- check<_>(u+j);
- check<terminal<int> >(u);
- check<plus<terminal<int>, terminal<int&> > >(u + j);
- check<plus<terminal<int>, terminal<int> > >(u + j);
-
- terminal<pair<int,double> >::type w = {};
- check<terminal<pair<int,double> > >(w);
- check<terminal<pair<_,double> > >(w);
-
- check<
- or_<
- minus<terminal<int>, terminal<int> >
- , plus<terminal<int>, terminal<int> >
- >
- >(u + j);
-
- check<function<Any> >(char_());
- check<function<Any, Char, Char> >(char_('a', 'b'));
-
- check_not<function<Any, Char> >(char_());
- check<function<Any, Char> >(char_('a'));
- check_not<function<Any, Char> >(char_('a', 'b'));
-
- check<function<Any, vararg<Char> > >(char_());
- check<function<Any, vararg<Char> > >(char_('a'));
- check<function<Any, vararg<Char> > >(char_('a', 'b'));
-
- 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_);
-
- plus<terminal<double>::type, terminal<int>::type>::type du =
- Promote::call(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_);
- 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::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_)
- );
-
- using fusion::cons;
- cons<char, cons<int, cons<float> > > mylist1 =
- ArgsAsList::call(_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_ ));
- std::cout << mylist2.car << ' ' << mylist2.cdr.car << ' ' << mylist2.cdr.cdr.car << std::endl;
-
- default_context ctx;
- int r1 = eval(as_expr(1) + as_expr(2), ctx);
- std::cout << r1 << std::endl;
-
- display_expr((_1 = 1, 'a', str));
-
- byvalexpr<
- expr<tag::plus
- , args<
- byvalexpr<expr<tag::terminal, term<int> > >
- , byvalexpr<expr<tag::divides, args<
- byvalexpr<expr<tag::terminal, term<int> > >
- , byvalexpr<expr<tag::terminal, term<int> > >
- > > >
- >
- >
- > bve = A+B/C;
+ //expr<tag::function,
+ // args<
+ // expr<tag::terminal, term<int> > const &
+ // , expr<tag::terminal, term<int const &> >
+ // , expr<tag::terminal, term<int &> >
+ // , expr<tag::terminal, term<int> > const &
+ // >
+ //> that = t(1,j,t);
+
+ //function<
+ // expr<tag::terminal, term<int> > const &
+ // , expr<tag::terminal, term<int const &> >
+ // , expr<tag::terminal, term<int &> >
+ // , expr<tag::terminal, term<int> > const &
+ //>::type other = t(1,j,t);
+
+ //expr<tag::assign,
+ // args<
+ // expr<tag::terminal, term<int> > const &
+ // , expr<tag::terminal, term<int const &> >
+ // >
+ //> that2 = (t = 1);
+
+ //expr<tag::posit,
+ // args<expr<tag::terminal, term<int> > const &>
+ //> that3 = +t;
+
+ //expr<tag::posit,
+ // args<expr<tag::terminal, term<int> > &>
+ //> that4 = +u;
+
+ //expr<tag::plus,
+ // args<
+ // expr<tag::terminal, term<int> > &
+ // , expr<tag::terminal, term<int &> >
+ // >
+ //> that5 = u + j;
+
+ //std::printf("%d %d\n", arg_c<0>(arg_c<0>(that5)), arg_c<0>(arg_c<1>(that5)));
+
+ //check<_>(u+j);
+ //check<terminal<int> >(u);
+ //check<plus<terminal<int>, terminal<int&> > >(u + j);
+ //check<plus<terminal<int>, terminal<int> > >(u + j);
+
+ //terminal<pair<int,double> >::type w = {};
+ //check<terminal<pair<int,double> > >(w);
+ //check<terminal<pair<_,double> > >(w);
+
+ //check<
+ // or_<
+ // minus<terminal<int>, terminal<int> >
+ // , plus<terminal<int>, terminal<int> >
+ // >
+ //>(u + j);
+
+ //check<function<Any> >(char_());
+ //check<function<Any, Char, Char> >(char_('a', 'b'));
+
+ //check_not<function<Any, Char> >(char_());
+ //check<function<Any, Char> >(char_('a'));
+ //check_not<function<Any, Char> >(char_('a', 'b'));
+
+ //check<function<Any, vararg<Char> > >(char_());
+ //check<function<Any, vararg<Char> > >(char_('a'));
+ //check<function<Any, vararg<Char> > >(char_('a', 'b'));
+
+ //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_);
+
+ //plus<terminal<double>::type, terminal<int>::type>::type du =
+ // Promote::call(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_);
+ //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::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_)
+ //);
+
+ //using fusion::cons;
+ //cons<char, cons<int, cons<float> > > mylist1 =
+ // ArgsAsList::call(_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_ ));
+ //std::cout << mylist2.car << ' ' << mylist2.cdr.car << ' ' << mylist2.cdr.cdr.car << std::endl;
+
+ //default_context ctx;
+ //int r1 = eval(as_expr(1) + as_expr(2), ctx);
+ //std::cout << r1 << std::endl;
+
+ //display_expr((_1 = 1, 'a', str));
+
+ //byvalexpr<
+ // expr<tag::plus
+ // , args<
+ // byvalexpr<expr<tag::terminal, term<int> > >
+ // , byvalexpr<expr<tag::divides, args<
+ // byvalexpr<expr<tag::terminal, term<int> > >
+ // , byvalexpr<expr<tag::terminal, term<int> > >
+ // > > >
+ // >
+ // >
+ //> bve = A+B/C;
 
     return 0;
 }


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