|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r60692 - in trunk/boost/proto: . detail
From: eric_at_[hidden]
Date: 2010-03-18 10:28:32
Author: eric_niebler
Date: 2010-03-18 10:28:31 EDT (Thu, 18 Mar 2010)
New Revision: 60692
URL: http://svn.boost.org/trac/boost/changeset/60692
Log:
fix error in invocation of callable monomorphic function objects, expression self-assignment creates an assign node
Text files modified:
trunk/boost/proto/detail/expr0.hpp | 19 ++++++++++++
trunk/boost/proto/detail/poly_function.hpp | 9 ++++--
trunk/boost/proto/extends.hpp | 60 ++++++++++++++++++++++++++++++++++++----
3 files changed, 79 insertions(+), 9 deletions(-)
Modified: trunk/boost/proto/detail/expr0.hpp
==============================================================================
--- trunk/boost/proto/detail/expr0.hpp (original)
+++ trunk/boost/proto/detail/expr0.hpp 2010-03-18 10:28:31 EDT (Thu, 18 Mar 2010)
@@ -133,6 +133,25 @@
/// Assignment
///
/// \param a The rhs.
+ /// \return A new \c expr\<\> node representing an assignment of \c that to \c *this.
+ proto::expr<
+ proto::tag::assign
+ , list2<expr &, expr const &>
+ , 2
+ > const
+ operator =(expr const &a)
+ {
+ proto::expr<
+ proto::tag::assign
+ , list2<expr &, expr const &>
+ , 2
+ > that = {*this, a};
+ return that;
+ }
+
+ /// Assignment
+ ///
+ /// \param a The rhs.
/// \return A new \c expr\<\> node representing an assignment of \c a to \c *this.
template<typename A>
proto::expr<
Modified: trunk/boost/proto/detail/poly_function.hpp
==============================================================================
--- trunk/boost/proto/detail/poly_function.hpp (original)
+++ trunk/boost/proto/detail/poly_function.hpp 2010-03-18 10:28:31 EDT (Thu, 18 Mar 2010)
@@ -173,12 +173,15 @@
#include BOOST_PP_ITERATE()
};
+ template<typename T>
+ struct wrap_t;
+
typedef char poly_function_t;
typedef char (&mono_function_t)[2];
typedef char (&unknown_function_t)[3];
-
- template<typename T> poly_function_t test_poly_function(T *, typename T::is_poly_function_base_ * = 0);
- template<typename T> mono_function_t test_poly_function(T *, typename T::result_type * = 0);
+
+ template<typename T> poly_function_t test_poly_function(T *, wrap_t<typename T::is_poly_function_base_> * = 0);
+ template<typename T> mono_function_t test_poly_function(T *, wrap_t<typename T::result_type> * = 0);
template<typename T> unknown_function_t test_poly_function(T *, ...);
////////////////////////////////////////////////////////////////////////////////////////////////
Modified: trunk/boost/proto/extends.hpp
==============================================================================
--- trunk/boost/proto/extends.hpp (original)
+++ trunk/boost/proto/extends.hpp 2010-03-18 10:28:31 EDT (Thu, 18 Mar 2010)
@@ -187,6 +187,37 @@
typedef void proto_is_aggregate_; \
/**< INTERNAL ONLY */
+ #define BOOST_PROTO_EXTENDS_ASSIGN_DEFAULT(This) \
+ typename boost::result_of< \
+ proto_domain( \
+ boost::proto::expr< \
+ boost::proto::tag::assign \
+ , boost::proto::list2< \
+ This & \
+ , This const & \
+ > \
+ , 2 \
+ > \
+ ) \
+ >::type const \
+ operator =(This const &a) \
+ { \
+ typedef boost::proto::expr< \
+ boost::proto::tag::assign \
+ , boost::proto::list2< \
+ This & \
+ , This const & \
+ > \
+ , 2 \
+ > that_type; \
+ that_type that = { \
+ *this \
+ , a \
+ }; \
+ return proto_domain()(that); \
+ } \
+ /**/
+
/// INTERNAL ONLY
///
#define BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(Const) \
@@ -251,15 +282,32 @@
} \
/**/
+ #define BOOST_PROTO_EXTENDS_ASSIGN_CONST_(This) \
+ BOOST_PROTO_EXTENDS_ASSIGN_DEFAULT(This) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(1) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST_(This) \
+ BOOST_PROTO_EXTENDS_ASSIGN_DEFAULT(This) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(0) \
+ /**/
+
+ #define BOOST_PROTO_EXTENDS_ASSIGN_(This) \
+ BOOST_PROTO_EXTENDS_ASSIGN_DEFAULT(This) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(0) \
+ BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(1) \
+ /**/
+
#define BOOST_PROTO_EXTENDS_ASSIGN_CONST() \
- BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(1)
+ BOOST_PROTO_EXTENDS_ASSIGN_CONST_(proto_derived_expr) \
+ /**/
#define BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST() \
- BOOST_PROTO_EXTENDS_ASSIGN_IMPL_(0)
+ BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST_(proto_derived_expr) \
+ /**/
#define BOOST_PROTO_EXTENDS_ASSIGN() \
- BOOST_PROTO_EXTENDS_ASSIGN_CONST() \
- BOOST_PROTO_EXTENDS_ASSIGN_NON_CONST() \
+ BOOST_PROTO_EXTENDS_ASSIGN_(proto_derived_expr) \
/**/
/// INTERNAL ONLY
@@ -465,7 +513,7 @@
{}
BOOST_PROTO_BASIC_EXTENDS_(Expr, Derived, Domain)
- BOOST_PROTO_EXTENDS_ASSIGN_CONST()
+ BOOST_PROTO_EXTENDS_ASSIGN_CONST_(extends)
BOOST_PROTO_EXTENDS_SUBSCRIPT_CONST()
// Instead of using BOOST_PROTO_EXTENDS_FUNCTION, which uses
@@ -508,7 +556,7 @@
{}
BOOST_PROTO_BASIC_EXTENDS_(Expr, Derived, Domain)
- BOOST_PROTO_EXTENDS_ASSIGN()
+ BOOST_PROTO_EXTENDS_ASSIGN_(extends)
BOOST_PROTO_EXTENDS_SUBSCRIPT()
// Instead of using BOOST_PROTO_EXTENDS_FUNCTION, which uses
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