Boost logo

Boost :

From: Sylvester-Bradley, Gareth (Gareth.Sylvester-Bradley_at_[hidden])
Date: 2008-07-17 04:45:40


Should function_equal work with nested binds?

 

I expected the following to work but it results in a compiler error:

 

 

#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

}

 

 

I made it compile by adding the following:

 

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);

    }

  }

}

 

Is that OK?

 

 

Thanks,

Gareth

 

************************************************************************
The information contained in this message or any of its attachments may be confidential and is intended for the exclusive use of the addressee(s). Any disclosure, reproduction, distribution or other dissemination or use of this communication is strictly prohibited without the express permission of the sender. The views expressed in this email are those of the individual and not necessarily those of Sony or Sony affiliated companies. Sony email is for business use only.

This email and any response may be monitored by Sony to be in compliance with Sony's global policies and standards


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk