|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66472 - in sandbox/SOC/2010/phoenix3: boost/phoenix/operator libs/phoenix/test/operator
From: thom.heller_at_[hidden]
Date: 2010-11-09 10:17:42
Author: theller
Date: 2010-11-09 10:17:39 EST (Tue, 09 Nov 2010)
New Revision: 66472
URL: http://svn.boost.org/trac/boost/changeset/66472
Log:
corrected member function operator
Text files modified:
sandbox/SOC/2010/phoenix3/boost/phoenix/operator/bitwise.hpp | 3 ++
sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp | 56 +++++++++++++++++----------------------
sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp | 17 +++++------
3 files changed, 35 insertions(+), 41 deletions(-)
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/bitwise.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/operator/bitwise.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/bitwise.hpp 2010-11-09 10:17:39 EST (Tue, 09 Nov 2010)
@@ -12,6 +12,9 @@
namespace boost { namespace phoenix
{
+ PHOENIX_UNARY_OPERATORS(
+ (complement)
+ )
PHOENIX_BINARY_OPERATORS(
(bitwise_and_assign)
Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/operator/member.hpp 2010-11-09 10:17:39 EST (Tue, 09 Nov 2010)
@@ -19,18 +19,28 @@
#include <boost/phoenix/support/iterate.hpp>
#include <boost/proto/make_expr.hpp>
#include <boost/proto/tags.hpp>
-#include <boost/type_traits/is_member_function_pointer.hpp>
#include <boost/type_traits/is_member_object_pointer.hpp>*/
+#include <boost/type_traits/is_member_function_pointer.hpp>
namespace boost { namespace phoenix
{
PHOENIX_BINARY_OPERATORS(
(mem_ptr)
)
- /*
- namespace detail
- {
+ namespace rule
+ {
+ struct function
+ : proto::function<proto::vararg<meta_grammar> >
+ {};
+ }
+
+ template <typename Dummy>
+ struct meta_grammar::case_<proto::tag::function, Dummy>
+ : proto::when<rule::function, proto::external_transform>
+ {};
+
+ namespace detail {
namespace result_of
{
template <typename Object, typename MemPtr,
@@ -85,16 +95,9 @@
};
- }
+ }
- ////////////////////////////////////////////////////////////////////////////
- //
- // This operator overload is preferred to Proto's when the second parameter
- // is a member function pointer. If it is a member object pointer, Proto's
- // default handling could do the right thing, if there wasn't MSVC.
- //
- ////////////////////////////////////////////////////////////////////////////
- template <typename Object, typename MemPtr>
+ template <typename Object, typename MemPtr>
typename enable_if<
is_member_function_pointer<MemPtr>
, detail::mem_fun_ptr<actor<Object>, MemPtr> const
@@ -103,25 +106,6 @@
{
return detail::mem_fun_ptr<actor<Object>, MemPtr>(obj, ptr);
}
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // This operator overload is preferred to Proto's when the second parameter
- // is a member object pointer. If it is a member object pointer, Proto's
- // default handling could do the right thing, if there wasn't MSVC.
- //
- ////////////////////////////////////////////////////////////////////////////
- template <typename Object, typename MemPtr>
- typename enable_if<
- is_member_object_pointer<MemPtr>
- , typename make_mem_obj_ptr<actor<Object>, MemPtr>::type const
- >::type
- operator->*(actor<Object> const& obj, MemPtr ptr)
- {
- return make_mem_obj_ptr<actor<Object>, MemPtr>()(obj, ptr);
- }
-*/
-
}}
#endif
@@ -150,5 +134,13 @@
proto::tag::function, phoenix_domain>(ptr, obj, PHOENIX_a);
}
+ template <PHOENIX_typename_A>
+ typename result_of::mem_fun_ptr<Object, MemPtr, PHOENIX_A>::type const
+ operator()(PHOENIX_A_ref_a) const
+ {
+ return proto::make_expr<
+ proto::tag::function, phoenix_domain>(ptr, obj, PHOENIX_a);
+ }
+
#endif
#endif
Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/test/operator/member.cpp 2010-11-09 10:17:39 EST (Tue, 09 Nov 2010)
@@ -49,16 +49,16 @@
((val(ptr)->*&Test::value) = 2)();
BOOST_TEST(test.value == 2);
- //BOOST_TEST((val(ptr)->*&Test::func)(3)() == 3);
- //int i = 33;
- //BOOST_TEST((arg1->*&Test::func)(arg2)(cptr, i) == i);
- //BOOST_TEST((val(cptr)->*&Test::func)(4)() == 4);
- //BOOST_TEST((val(ptr)->*&Test::dunc)()() == 10);
+ val(ptr)->*&Test::func;
+ BOOST_TEST((val(ptr)->*&Test::func)(3)() == 3);
+ int i = 33;
+ BOOST_TEST((arg1->*&Test::func)(arg2)(cptr, i) == i);
+ BOOST_TEST((val(cptr)->*&Test::func)(4)() == 4);
+ BOOST_TEST((val(ptr)->*&Test::dunc)()() == 10);
- //BOOST_TEST((arg1->*&Test::func)(5)(ptr) == 5);
- //BOOST_TEST((arg1->*&Test::kunc)()(ptr));
+ BOOST_TEST((arg1->*&Test::func)(5)(ptr) == 5);
+ BOOST_TEST((arg1->*&Test::kunc)()(ptr));
- /*
shared_ptr<Test> sptr(new Test(test));
BOOST_TEST((arg1->*&Test::value)(sptr) == 2);
@@ -88,7 +88,6 @@
BOOST_TEST((arg1->*&Test::value)(captr) == 2);
BOOST_TEST((arg1->*&Test::func)(11)(captr) == 11);
- */
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