[Boost-bugs] [Boost C++ Libraries] #2849: function_equal should work with binds holding weak_ptr values

Subject: [Boost-bugs] [Boost C++ Libraries] #2849: function_equal should work with binds holding weak_ptr values
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-12 11:34:35


#2849: function_equal should work with binds holding weak_ptr values
-----------------------------------------------------------------------------+
 Reporter: Gareth Sylvester-Bradley <gareth.sylvester-bradley_at_[hidden]> | Owner: pdimov
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: bind
  Version: Boost 1.35.0 | Severity: Problem
 Keywords: |
-----------------------------------------------------------------------------+
 http://lists.boost.org/Archives/boost/2008/07/139970.php

 To fix the compiler error in the program below, please can we add the
 following (e.g. to boost/bind.hpp) -

 {{{
 #include <boost/weak_ptr.hpp>

 namespace boost
 {
   namespace _bi
   {
     template<class T> bool ref_compare( value< weak_ptr<T> >
 const & a, value< weak_ptr<T> > const & b, long )
     {
       return !(a.get() < b.get()) && !(b.get() < a.get());
     }
   }
 }
 }}}

 -- main.cpp --

 {{{
 #include <boost/function_equal.hpp>
 #include <boost/bind.hpp>
 #include <boost/weak_ptr.hpp>

 int h( boost::weak_ptr<void> wp ) { return wp.use_count(); }

 template < typename F > bool self_equal( F f_ )
 {
   return function_equal( f_, f_ );
 }

 int main( int argc, char * const argv[] )
 {
   self_equal( boost::bind( h, _1 ) ); // OK
   self_equal( boost::bind( h, boost::weak_ptr<void>() ) ); // compiler
 error
   return 0;
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2849>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC