$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: eric_at_[hidden]
Date: 2007-12-10 16:15:36
Author: eric_niebler
Date: 2007-12-10 16:15:35 EST (Mon, 10 Dec 2007)
New Revision: 41960
URL: http://svn.boost.org/trac/boost/changeset/41960
Log:
clean-up
Text files modified: 
   branches/proto/v3/boost/xpressive/proto/deep_copy.hpp    |     1                                         
   branches/proto/v3/boost/xpressive/regex_actions.hpp      |   146 ++++++++++++++++++++++++--------------- 
   branches/proto/v3/libs/xpressive/proto/example/calc1.cpp |     2                                         
   branches/proto/v3/libs/xpressive/proto/example/calc2.cpp |     2                                         
   branches/proto/v3/libs/xpressive/proto/example/calc3.cpp |     2                                         
   branches/proto/v3/libs/xpressive/proto/example/mixed.cpp |    54 ++++++++------                          
   6 files changed, 125 insertions(+), 82 deletions(-)
Modified: branches/proto/v3/boost/xpressive/proto/deep_copy.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/proto/deep_copy.hpp	(original)
+++ branches/proto/v3/boost/xpressive/proto/deep_copy.hpp	2007-12-10 16:15:35 EST (Mon, 10 Dec 2007)
@@ -55,6 +55,7 @@
         template<typename Expr, typename T>
         struct deep_copy_impl<Expr, term<T> >
         {
+            // TODO don't unref reference to function!
             typedef typename terminal<UNCVREF(T)>::type expr_type;
             typedef typename Expr::proto_domain::template apply<expr_type>::type type;
 
Modified: branches/proto/v3/boost/xpressive/regex_actions.hpp
==============================================================================
--- branches/proto/v3/boost/xpressive/regex_actions.hpp	(original)
+++ branches/proto/v3/boost/xpressive/regex_actions.hpp	2007-12-10 16:15:35 EST (Mon, 10 Dec 2007)
@@ -686,6 +686,8 @@
         }
     };
 
+    /// as (a.k.a., lexical_cast)
+    ///
     template<typename T, typename A>
     typename proto::result_of::make_expr<
         proto::tag::function
@@ -702,45 +704,59 @@
         >::call(op::as<T>(), a);
     }
 
-    ///// as (a.k.a., lexical_cast)
-    /////
-    //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
-    //    1
-    //  , as
-    //  , boost::proto::default_domain
-    //  , (boost::proto::tag::function)
-    //  , ((op::as)(typename))
-    //)
-
-    ///// static_cast_
-    /////
-    //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
-    //    1
-    //  , static_cast_
-    //  , boost::proto::default_domain
-    //  , (boost::proto::tag::function)
-    //  , ((op::static_cast_)(typename))
-    //)
-
-    ///// dynamic_cast_
-    /////
-    //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
-    //    1
-    //  , dynamic_cast_
-    //  , boost::proto::default_domain
-    //  , (boost::proto::tag::function)
-    //  , ((op::dynamic_cast_)(typename))
-    //)
-
-    ///// const_cast_
-    /////
-    //BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(
-    //    1
-    //  , const_cast_
-    //  , boost::proto::default_domain
-    //  , (boost::proto::tag::function)
-    //  , ((op::const_cast_)(typename))
-    //)
+    /// static_cast_
+    ///
+    template<typename T, typename A>
+    typename proto::result_of::make_expr<
+        proto::tag::function
+      , proto::default_domain
+      , op::static_cast_<T> const
+      , A
+    >::type static_cast_(A &&a)
+    {
+        return proto::result_of::make_expr<
+            proto::tag::function
+          , proto::default_domain
+          , op::static_cast_<T> const
+          , A
+        >::call(op::static_cast_<T>(), a);
+    }
+
+    /// dynamimc_cast_
+    ///
+    template<typename T, typename A>
+    typename proto::result_of::make_expr<
+        proto::tag::function
+      , proto::default_domain
+      , op::dynamic_cast_<T> const
+      , A
+    >::type dynamic_cast_(A &&a)
+    {
+        return proto::result_of::make_expr<
+            proto::tag::function
+          , proto::default_domain
+          , op::dynamic_cast_<T> const
+          , A
+        >::call(op::dynamic_cast_<T>(), a);
+    }
+
+    /// const_cast_
+    ///
+    template<typename T, typename A>
+    typename proto::result_of::make_expr<
+        proto::tag::function
+      , proto::default_domain
+      , op::const_cast_<T> const
+      , A
+    >::type const_cast_(A &&a)
+    {
+        return proto::result_of::make_expr<
+            proto::tag::function
+          , proto::default_domain
+          , op::const_cast_<T> const
+          , A
+        >::call(op::const_cast_<T>(), a);
+    }
 
     /// val()
     ///
@@ -789,23 +805,41 @@
         BOOST_PROTO_EXTENDS_FUNCTION(action_arg_type, this_type, proto::default_domain)
     };
 
-    ///// Usage: construct\<Type\>(arg1, arg2)
-    /////
-    //BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
-    //    construct
-    //  , boost::proto::default_domain
-    //  , (boost::proto::tag::function)
-    //  , ((op::construct)(typename))
-    //)
-
-    ///// Usage: throw_\<Exception\>(arg1, arg2)
-    /////
-    //BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(
-    //    throw_
-    //  , boost::proto::default_domain
-    //  , (boost::proto::tag::function)
-    //  , ((op::throw_)(typename))
-    //)
+    /// Usage: construct\<Type\>(arg1, arg2)
+    ///
+    template<typename T, typename... A>
+    typename proto::result_of::make_expr<
+        proto::tag::function
+      , proto::default_domain
+      , op::construct<T> const
+      , A...
+    >::type construct(A &&... a)
+    {
+        return proto::result_of::make_expr<
+            proto::tag::function
+          , proto::default_domain
+          , op::construct<T> const
+          , A...
+        >::call(op::construct<T>(), a...);
+    }
+
+    /// Usage: throw_\<Exception\>(arg1, arg2)
+    ///
+    template<typename T, typename... A>
+    typename proto::result_of::make_expr<
+        proto::tag::function
+      , proto::default_domain
+      , op::throw_<T> const
+      , A...
+    >::type throw_(A &&... a)
+    {
+        return proto::result_of::make_expr<
+            proto::tag::function
+          , proto::default_domain
+          , op::throw_<T> const
+          , A...
+        >::call(op::throw_<T>(), a...);
+    }
 
     namespace detail
     {
Modified: branches/proto/v3/libs/xpressive/proto/example/calc1.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/example/calc1.cpp	(original)
+++ branches/proto/v3/libs/xpressive/proto/example/calc1.cpp	2007-12-10 16:15:35 EST (Mon, 10 Dec 2007)
@@ -60,7 +60,7 @@
     // Displays "6"
     std::cout << evaluate( _1 * _2, 3.0, 2.0 ) << std::endl;
 
-    // Displays "1.5"
+    // Displays "0.5"
     std::cout << evaluate( (_1 - _2) / _2, 3.0, 2.0 ) << std::endl;
 
     return 0;
Modified: branches/proto/v3/libs/xpressive/proto/example/calc2.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/example/calc2.cpp	(original)
+++ branches/proto/v3/libs/xpressive/proto/example/calc2.cpp	2007-12-10 16:15:35 EST (Mon, 10 Dec 2007)
@@ -100,7 +100,7 @@
     // Displays "6"
     std::cout << ( _1 * _2 )( 3.0, 2.0 ) << std::endl;
 
-    // Displays "1.5"
+    // Displays "0.5"
     std::cout << ( (_1 - _2) / _2 )( 3.0, 2.0 ) << std::endl;
 
     return 0;
Modified: branches/proto/v3/libs/xpressive/proto/example/calc3.cpp
==============================================================================
--- branches/proto/v3/libs/xpressive/proto/example/calc3.cpp	(original)
+++ branches/proto/v3/libs/xpressive/proto/example/calc3.cpp	2007-12-10 16:15:35 EST (Mon, 10 Dec 2007)
@@ -147,7 +147,7 @@
     // Displays "6"
     std::cout << ( _1 * _2 )( 3.0, 2.0 ) << std::endl;
 
-    // Displays "1.5"
+    // Displays "0.5"
     std::cout << ( (_1 - _2) / _2 )( 3.0, 2.0 ) << std::endl;
 
     // This won't compile because the arity of the
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-10 16:15:35 EST (Mon, 10 Dec 2007)
@@ -232,28 +232,36 @@
         }
     };
 
-    //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);
+        }
+    };
+
+    template<typename A>
+    typename proto::result_of::make_expr<
+        proto::tag::function
+      , MixedDomain
+      , sin_ const
+      , A
+    >::type sin(A &&a)
+    {
+        return proto::result_of::make_expr<
+            proto::tag::function
+          , MixedDomain
+          , sin_ const
+          , A
+        >::call(sin_(), a);
+    }
 
     template<typename FwdIter, typename Expr, typename Op>
     void evaluate(FwdIter begin, FwdIter end, Expr const &expr, Op op)
@@ -345,7 +353,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();