|
Boost Users : |
From: Alex MDC (alex.mdc_at_[hidden])
Date: 2008-07-08 03:39:00
I think what you're after is documented here:
http://www.boost.org/doc/libs/1_35_0/libs/bind/bind.html#nested_binds
Here's my attempt (though I haven't got access to a compiler atm):
function1<bool, Outer*> func = boost::bind(&Inner::good,
boost::bind(&Outer::inner, _1));
find_if(outers.begin(), outers.end(), func);
Hope that helps!
Alex
2008/7/8 Igor R <boost.lists_at_[hidden]>:
> Hello,
>
> struct Inner
> {
> bool good() const;
> };
> struct Outer
> {
> Inner inner_;
> const Inner &inner() const
> { return inner_; }
> };
>
> std::vector<Outer> outers;
>
> I'd like to find Outer whose Inner is good():
>
> std::find_if(outers.begin(), outers.end(), ?);
>
> How should I use boost::bind or boost::lambda to tell the stl
> algorithms to call Inner::good()?
>
> Thank you in advance!
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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