Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-01-04 18:09:58


Allen Zhao wrote:

> With regard to the boost:bind problem, I am not sure what happened.
> BTW, anyone
> knows the equalivalent form for the following nested bind:
>
> struct peer
> {
> enum connection_type { not_connectable,connectable };
>
> peer(const address& ip, connection_type t);
> ...
> peer_connection* connection;
> };
>
> std::vector<peer> m_peers;
> peer_connection& c;
>
>
> assert(std::find_if(m_peers.begin(), m_peers.end()
> , boost::bind(std::equal_to<peer_connection*>(),

Try

    boost::bind<bool>( std::equal_to<peer_connection*>(),

> boost::bind(&peer::connection, _1)
> , &c)) != m_peers.end());

or possibly

    boost::bind( &peer::connection, _1 ) == &c

> I am trying to invoke the predicate std:equal_to() directly,
> therefore remove the first boost::bind()..


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