Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2007-09-13 15:06:54


Author: dgregor
Date: 2007-09-13 15:06:53 EDT (Thu, 13 Sep 2007)
New Revision: 39244
URL: http://svn.boost.org/trac/boost/changeset/39244

Log:
function_template.hpp:
  - Pass-by-reference internally, when we can. Fixes #1067

Text files modified:
   trunk/boost/function/function_template.hpp | 10 +++++-----
   1 files changed, 5 insertions(+), 5 deletions(-)

Modified: trunk/boost/function/function_template.hpp
==============================================================================
--- trunk/boost/function/function_template.hpp (original)
+++ trunk/boost/function/function_template.hpp 2007-09-13 15:06:53 EDT (Thu, 13 Sep 2007)
@@ -426,7 +426,7 @@
                                             BOOST_FUNCTION_TEMPLATE_ARGS);
 
         template<typename F>
- bool assign_to(F f, function_buffer& functor) const
+ bool assign_to(const F& f, function_buffer& functor) const
         {
           typedef typename get_function_tag<F>::type tag;
           return assign_to(f, functor, tag());
@@ -477,7 +477,7 @@
         // Assign to a function object using the small object optimization
         template<typename FunctionObj>
         void
- assign_functor(FunctionObj f, function_buffer& functor,
+ assign_functor(const FunctionObj& f, function_buffer& functor,
                        mpl::true_) const
         {
           new ((void*)&functor.data) FunctionObj(f);
@@ -486,7 +486,7 @@
         // Assign to a function object allocated on the heap.
         template<typename FunctionObj>
         void
- assign_functor(FunctionObj f, function_buffer& functor,
+ assign_functor(const FunctionObj& f, function_buffer& functor,
                        mpl::false_) const
         {
 #ifndef BOOST_NO_STD_ALLOCATOR
@@ -507,7 +507,7 @@
 
         template<typename FunctionObj>
         bool
- assign_to(FunctionObj f, function_buffer& functor,
+ assign_to(const FunctionObj& f, function_buffer& functor,
                   function_obj_tag) const
         {
           if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
@@ -765,7 +765,7 @@
     }
 
     template<typename Functor>
- void assign_to(Functor f)
+ void assign_to(const Functor& f)
     {
       using detail::function::vtable_base;
 


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