|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72317 - in trunk/boost/spirit/home/support/utree: . detail
From: blelbach_at_[hidden]
Date: 2011-06-01 00:49:48
Author: wash
Date: 2011-06-01 00:49:47 EDT (Wed, 01 Jun 2011)
New Revision: 72317
URL: http://svn.boost.org/trac/boost/changeset/72317
Log:
Make utree's eval method dispatch properly for utree reference types, make utree's
boolean constructor explicit, fix constness problem with utree functions.
Text files modified:
trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp | 10 ++++++++--
trunk/boost/spirit/home/support/utree/utree.hpp | 8 ++++----
2 files changed, 12 insertions(+), 6 deletions(-)
Modified: trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp (original)
+++ trunk/boost/spirit/home/support/utree/detail/utree_detail2.hpp 2011-06-01 00:49:47 EDT (Wed, 01 Jun 2011)
@@ -649,7 +649,7 @@
}
template <typename F>
- utree stored_function<F>::operator()(utree& env)
+ utree stored_function<F>::operator()(utree& env) const
{
return f(env);
}
@@ -679,7 +679,7 @@
}
template <typename F>
- utree referenced_function<F>::operator()(utree& env)
+ utree referenced_function<F>::operator()(utree& env) const
{
return f(env);
}
@@ -1593,6 +1593,9 @@
inline utree utree::eval(utree const& env) const
{
+ if (get_type() == type::reference_type)
+ return deref().eval(env);
+
if (get_type() != type::function_type)
BOOST_THROW_EXCEPTION(
bad_type_exception(
@@ -1602,6 +1605,9 @@
inline utree utree::eval(utree& env) const
{
+ if (get_type() == type::reference_type)
+ return deref().eval(env);
+
if (get_type() != type::function_type)
BOOST_THROW_EXCEPTION(
bad_type_exception(
Modified: trunk/boost/spirit/home/support/utree/utree.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/utree.hpp (original)
+++ trunk/boost/spirit/home/support/utree/utree.hpp 2011-06-01 00:49:47 EDT (Wed, 01 Jun 2011)
@@ -245,7 +245,7 @@
{
virtual ~function_base() {}
virtual utree operator()(utree const& env) const = 0;
- virtual utree operator()(utree& env) = 0;
+ virtual utree operator()(utree& env) const = 0;
// Calling f.clone() must return a newly allocated function_base
// instance that is equal to f.
@@ -259,7 +259,7 @@
stored_function(F f = F());
virtual ~stored_function();
virtual utree operator()(utree const& env) const;
- virtual utree operator()(utree& env);
+ virtual utree operator()(utree& env) const;
virtual function_base* clone() const;
};
@@ -270,7 +270,7 @@
referenced_function(F& f);
virtual ~referenced_function();
virtual utree operator()(utree const& env) const;
- virtual utree operator()(utree& env);
+ virtual utree operator()(utree& env) const;
virtual function_base* clone() const;
};
//]
@@ -384,7 +384,7 @@
// This initializes a `boolean_type` node, which can hold 'true' or
// 'false' only.
- utree(bool);
+ explicit utree(bool);
reference operator=(bool);
// This initializes an `integer_type` node, which can hold arbitrary
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