Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52777 - sandbox/boost0x/boost/function
From: sebastian.redl_at_[hidden]
Date: 2009-05-05 18:06:15


Author: cornedbee
Date: 2009-05-05 18:06:14 EDT (Tue, 05 May 2009)
New Revision: 52777
URL: http://svn.boost.org/trac/boost/changeset/52777

Log:
Update variadic function
Text files modified:
   sandbox/boost0x/boost/function/function_variadic.hpp | 59 +++++++++++++++++++++++++++++++++++++++
   1 files changed, 58 insertions(+), 1 deletions(-)

Modified: sandbox/boost0x/boost/function/function_variadic.hpp
==============================================================================
--- sandbox/boost0x/boost/function/function_variadic.hpp (original)
+++ sandbox/boost0x/boost/function/function_variadic.hpp 2009-05-05 18:06:14 EDT (Tue, 05 May 2009)
@@ -28,7 +28,7 @@
             };
             template <typename R, typename Arg1, typename Arg2>
             struct which_std_function<R, Arg1, Arg2> {
- typedef std::unary_function<Arg1, Arg2, R> type;
+ typedef std::binary_function<Arg1, Arg2, R> type;
             };
         }
     }
@@ -37,5 +37,62 @@
     class function<R (Args...)> : public function_base,
         public detail::function::which_std_function<R, Args...>::type
     {
+ typedef function_base base_type;
+ typedef function<R (Args...)> self_type;
+ struct clear_type {};
+
+ public:
+
+ function() : base_type() {}
+
+ template<typename Functor>
+ function(Functor f
+ ,typename enable_if_c<
+ (boost::type_traits::ice_not<
+ (is_integral<Functor>::value)>::value),
+ int>::type = 0
+ ) :
+ base_type(f)
+ {
+ }
+ template<typename Functor, typename Allocator>
+ function(Functor f, Allocator a
+ ,typename enable_if_c<
+ (boost::type_traits::ice_not<
+ (is_integral<Functor>::value)>::value),
+ int>::type = 0
+ ) :
+ base_type(f,a)
+ {
+ }
+
+ function(clear_type*) : base_type() {}
+
+ function(const self_type& f)
+ : base_type(static_cast<const base_type&>(f))
+ {}
+
+ self_type& operator=(const self_type& f)
+ {
+ self_type(f).swap(*this);
+ return *this;
+ }
+
+ template<typename Functor>
+ typename enable_if_c<
+ (boost::type_traits::ice_not<
+ (is_integral<Functor>::value)>::value),
+ self_type&>::type
+ operator=(Functor f)
+ {
+ self_type(f).swap(*this);
+ return *this;
+ }
+
+ self_type& operator=(clear_type*)
+ {
+ this->clear();
+ return *this;
+ }
     };
 }


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