Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-02-22 19:37:46


Antonio Piccolboni wrote:

> On 2/22/06, Peter Dimov <pdimov_at_[hidden]> wrote:

>> bind( std::accumulate< std::vector<int>::iterator, int >, _1, _2, 0 )

>> might work.

> Thanks Peter, but it does not. Error message
>
> bind_test.cpp: In function 'int main()':
> bind_test.cpp:33: error: no matching function for call to
> 'bind(<unknown type>, const
> boost::lambda::lambda_functor<boost::lambda::placeholder<1> >&, const
> boost::lambda::lambda_functor<boost::lambda::placeholder<2> >&, int)'

You are right, my g++ 3.4.4 also doesn't like it. MSVC 7.1 does, however, at
least with boost::bind. There's always the workaround of using a cast or a
temporary function pointer:

    typedef std::vector<int>::iterator It;

    int (*pf)( It, It, int ) = std::accumulate;
    bind( pf, _1, _2, 0 );


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net