Opened 14 years ago

Closed 14 years ago

#2127 closed Bugs (fixed)

function_equal should work with nested binds

Reported by: Gareth Sylvester-Bradley <gareth.sylvester-bradley@…> Owned by: Peter Dimov
Milestone: Boost 1.39.0 Component: bind
Version: Boost 1.35.0 Severity: Problem
Keywords: Cc:

Description

http://lists.boost.org/Archives/boost/2008/07/139992.php

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

namespace boost
{
  namespace _bi
  {
    template<class R, class F, class L> bool ref_compare( bind_t<R,F,L>
const & a, bind_t<R,F,L> const & b, long )
    {
      return a.compare(b);
    }
  }
} 

-- main.cpp --

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

void f( int ) {}
int g( int i ) { return i+5; }

template < typename F > bool self_equal( F f_ )
{
  return function_equal( f_, f_ );
}
 
int main( int argc, char * const argv[] )
{
  self_equal( boost::bind( f, _1 ) ); // OK
  self_equal( boost::bind( g, _1 ) ); // OK
  self_equal( boost::bind( f, boost::bind( g, _1 ) ) ); // compiler
error
  return 0;
}

Change History (4)

comment:1 by Peter Dimov, 14 years ago

Milestone: Boost 1.35.1Boost 1.37.0
Status: newassigned

comment:2 by Peter Dimov, 14 years ago

Milestone: Boost 1.37.0Boost 1.39.0

comment:3 by Peter Dimov, 14 years ago

(In [51511]) Refs #2127 (fixed in trunk).

comment:4 by Peter Dimov, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [51533]) Merge [51511] to release. Closes #2127.

Note: See TracTickets for help on using tickets.