Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61448 - trunk/libs/spirit/example/scheme/scheme
From: joel_at_[hidden]
Date: 2010-04-21 00:50:04


Author: djowel
Date: 2010-04-21 00:50:03 EDT (Wed, 21 Apr 2010)
New Revision: 61448
URL: http://svn.boost.org/trac/boost/changeset/61448

Log:
supplanting boost::functiion with a utree polymorphic function implementation.
Text files modified:
   trunk/libs/spirit/example/scheme/scheme/interpreter.hpp | 14 ++++++--------
   1 files changed, 6 insertions(+), 8 deletions(-)

Modified: trunk/libs/spirit/example/scheme/scheme/interpreter.hpp
==============================================================================
--- trunk/libs/spirit/example/scheme/scheme/interpreter.hpp (original)
+++ trunk/libs/spirit/example/scheme/scheme/interpreter.hpp 2010-04-21 00:50:03 EDT (Wed, 21 Apr 2010)
@@ -27,9 +27,7 @@
     // typedefs
     ///////////////////////////////////////////////////////////////////////////
     struct function;
-
     typedef std::list<function> actor_list;
- typedef boost::function<utree(args_type args)> stored_function;
 
     ///////////////////////////////////////////////////////////////////////////
     // actor
@@ -88,24 +86,24 @@
     ///////////////////////////////////////////////////////////////////////////
     struct function : actor<function>
     {
- stored_function f;
+ utree f;
         function()
           : f() {}
 
- function(stored_function const& f)
- : f(f)
+ template <typename F>
+ function(F const& f)
+ : f(polymorphic_function<F>(f))
         {
- BOOST_ASSERT(!f.empty());
         }
 
         bool empty() const
         {
- return f.empty();
+ return f.which() != utree_type::function_type;
         }
 
         utree eval(args_type args) const
         {
- return f(args);
+ return f.eval(args);
         }
     };
 


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