Subject: [Boost-bugs] [Boost C++ Libraries] #2127: function_equal should work with nested binds
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-07-18 13:33:46
#2127: function_equal should work with nested binds
-----------------------------------------------------------------------------+
Reporter: Gareth Sylvester-Bradley <gareth.sylvester-bradley_at_[hidden]> | Owner: pdimov
Type: Bugs | Status: new
Milestone: Boost 1.35.1 | Component: bind
Version: Boost 1.35.0 | Severity: Problem
Keywords: |
-----------------------------------------------------------------------------+
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;
}
}}}
-- Ticket URL: <http://svn.boost.org/trac/boost/ticket/2127> 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:58 UTC