Boost logo

Boost-Commit :

From: stipe_at_[hidden]
Date: 2008-03-01 14:54:51


Author: srajko
Date: 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
New Revision: 43442
URL: http://svn.boost.org/trac/boost/changeset/43442

Log:
updated bind_mem_fn
Text files modified:
   sandbox/SOC/2007/signals/boost/dataflow/utility/bind_mem_fn.hpp | 10 +++-------
   sandbox/SOC/2007/signals/boost/dataflow/utility/slot_type.hpp | 6 +++---
   sandbox/SOC/2007/signals/boost/dataflow/utility/underlying_type.hpp | 1 +
   sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj | 2 --
   sandbox/SOC/2007/signals/libs/dataflow/doc/Jamfile.v2 | 2 +-
   sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk | 4 ++++
   sandbox/SOC/2007/signals/libs/dataflow/doc/utility/utility.qbk | 13 +++++++++++++
   sandbox/SOC/2007/signals/libs/dataflow/test/utility/test_bind_mem_fn.cpp | 14 +++++++++-----
   8 files changed, 34 insertions(+), 18 deletions(-)

Modified: sandbox/SOC/2007/signals/boost/dataflow/utility/bind_mem_fn.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/utility/bind_mem_fn.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/utility/bind_mem_fn.hpp 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -32,6 +32,9 @@
 
 } // namespace detail
 
+/// Binds a class member function to a class object.
+/** \returns boost::function type with the bound member function.
+*/
 template<typename MemFn, typename T>
 boost::function<typename member_function_signature<MemFn>::type>
     bind_mem_fn(MemFn mem_fn, T &object)
@@ -54,13 +57,6 @@
                         BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
                         BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(BOOST_PP_ITERATION()),_));
     }
-/* boost::function<typename member_function_signature<MemFn>::type>
- operator()(MemFn mem_fn, const T &object)
- {
- return boost::bind(mem_fn, boost::cref(object)
- BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
- BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(BOOST_PP_ITERATION()),_));
- }*/
 };
 
 #endif // defined(BOOST_PP_IS_ITERATING)

Modified: sandbox/SOC/2007/signals/boost/dataflow/utility/slot_type.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/utility/slot_type.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/utility/slot_type.hpp 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -15,9 +15,9 @@
 
 namespace utility {
 
-// Constructs a type corresponding to pointer to member of T with signature Signature.
-// e.g. slot_type<some_class, void(float)>::type is void (some_class::*) (float)
-
+/// Constructs a type corresponding to pointer to member of T with signature Signature.
+/** e.g. slot_type<some_class, void(float)>::type is void (some_class::*) (float)
+*/
     template <typename Signature, typename T>
     struct slot_type
     {

Modified: sandbox/SOC/2007/signals/boost/dataflow/utility/underlying_type.hpp
==============================================================================
--- sandbox/SOC/2007/signals/boost/dataflow/utility/underlying_type.hpp (original)
+++ sandbox/SOC/2007/signals/boost/dataflow/utility/underlying_type.hpp 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -11,6 +11,7 @@
 
 namespace boost { namespace dataflow { namespace utility {
 
+/// Returns the cv-unqualified, unreferenced version of a type.
 template<typename T>
 struct underlying_type
 {

Modified: sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/build/xcodeide/dataflow.xcodeproj/project.pbxproj 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -111,7 +111,6 @@
                 08668C4E0C19A16300ACB19A /* simple_distributed_example.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = simple_distributed_example.cpp; sourceTree = "<group>"; };
                 08668C4F0C19A16300ACB19A /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
                 088FC6BF0D5A6EAD004F0E76 /* Jamfile.v2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Jamfile.v2; sourceTree = "<group>"; };
- 088FC6C10D5A6EEC004F0E76 /* test_forced_as_vector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = test_forced_as_vector.cpp; sourceTree = "<group>"; };
                 089AE57F0D79C5CF00AB9DA8 /* bind_mem_fn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bind_mem_fn.hpp; sourceTree = "<group>"; };
                 089AE5830D79C7CB00AB9DA8 /* bind_object.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bind_object.hpp; sourceTree = "<group>"; };
                 089AE58B0D79C96200AB9DA8 /* slot_type.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = slot_type.hpp; sourceTree = "<group>"; };
@@ -350,7 +349,6 @@
                         isa = PBXGroup;
                         children = (
                                 088FC6BF0D5A6EAD004F0E76 /* Jamfile.v2 */,
- 088FC6C10D5A6EEC004F0E76 /* test_forced_as_vector.cpp */,
                                 0842A3600D5A7A8700CF8479 /* test_forced_sequence.cpp */,
                                 089AE5BC0D79CE5E00AB9DA8 /* test_bind_mem_fn.cpp */,
                         );

Modified: sandbox/SOC/2007/signals/libs/dataflow/doc/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/doc/Jamfile.v2 (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/doc/Jamfile.v2 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -73,7 +73,7 @@
       [ glob ../../../boost/dataflow/utility/*.hpp ]
    :
         <doxygen:param>TAB_SIZE=4
- <doxygen:param>EXAMPLE_PATH=../test
+ <doxygen:param>EXAMPLE_PATH=../test/utility
         <doxygen:param>EXAMPLE_PATH=../example
         <doxygen:param>STRIP_FROM_PATH=$(root)
         <doxygen:param>STRIP_FROM_INC_PATH=$(root)

Modified: sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/doc/dataflow.qbk 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -92,6 +92,8 @@
 [template socket_receiver[] [link dataflow.signals.components.network.socket_receiver socket_receiver]]
 [template chain[] [link dataflow.signals.components.topologies.chain chain]]
 
+[template bind_mem_fn[] [link dataflow.utility.bind_mem_fn bind_mem_fn]]
+
 [template fusion[] [@http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html Boost.Fusion]]
 [template BoostFusion[] [@http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html Boost.Fusion]]
 [template BoostIostreams[] [@http://www.boost.org/libs/iostreams/doc/index.html]]
@@ -160,6 +162,8 @@
 [import ../test/signals/test_junction.cpp]
 [import ../test/signals/test_mutex.cpp]
 
+[import ../test/utility/test_bind_mem_fn.cpp]
+
 [import ../example/fibonacci.cpp]
 [import ../example/signals/simple_example_components.hpp]
 [import ../example/signals/simple_example.cpp]

Modified: sandbox/SOC/2007/signals/libs/dataflow/doc/utility/utility.qbk
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/doc/utility/utility.qbk (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/doc/utility/utility.qbk 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -1,5 +1,18 @@
 [section:utility Miscellaneous utilities]
 
+[section bind_mem_fn]
+
+* See also: [funcref boost::dataflow::utility::bind_mem_fn bind_mem_fn reference]
+
+[bind_mem_fn] can be used to bind a class member function to a class object.
+It returns a boost::function, which can be used as a [DataflowSignals] [Port].
+
+[heading Example]
+
+[test_bind_mem_fn]
+
+[endsect]
+
 [xinclude ../dataflow_utility_doxygen.xml]
 
 [endsect]
\ No newline at end of file

Modified: sandbox/SOC/2007/signals/libs/dataflow/test/utility/test_bind_mem_fn.cpp
==============================================================================
--- sandbox/SOC/2007/signals/libs/dataflow/test/utility/test_bind_mem_fn.cpp (original)
+++ sandbox/SOC/2007/signals/libs/dataflow/test/utility/test_bind_mem_fn.cpp 2008-03-01 14:54:50 EST (Sat, 01 Mar 2008)
@@ -1,3 +1,5 @@
+//[ test_bind_mem_fn
+
 // Copyright Stjepan Rajko 2008. Use, modification and
 // distribution is subject to the Boost Software License, Version
 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -27,23 +29,25 @@
 int test_main(int, char* [])
 {
     using namespace boost;
- namespace df=boost::dataflow;
+ using boost::dataflow::utility::bind_mem_fn;
     
     sum test_sum(1);
     
- boost::function<int(int)> fun1 = df::utility::bind_mem_fn(&sum::add1, test_sum);
- boost::function<int(int, int)> fun2 = df::utility::bind_mem_fn(&sum::add2, test_sum);
+ boost::function<int(int)> fun1 = bind_mem_fn(&sum::add1, test_sum);
+ boost::function<int(int, int)> fun2 = bind_mem_fn(&sum::add2, test_sum);
     
     BOOST_CHECK_EQUAL(fun1(2), 3);
     BOOST_CHECK_EQUAL(fun2(2, 3), 6);
     
     const sum const_test_sum(2);
 
- boost::function<int(int)> cfun1 = df::utility::bind_mem_fn(&sum::add1, const_test_sum);
- boost::function<int(int, int)> cfun2 = df::utility::bind_mem_fn(&sum::add2, const_test_sum);
+ boost::function<int(int)> cfun1 = bind_mem_fn(&sum::add1, const_test_sum);
+ boost::function<int(int, int)> cfun2 = bind_mem_fn(&sum::add2, const_test_sum);
 
     BOOST_CHECK_EQUAL(cfun1(2), 4);
     BOOST_CHECK_EQUAL(cfun2(2, 3), 7);
 
     return 0;
 } // int test_main(int, char* [])
+
+//]
\ No newline at end of file


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