bind1st and bind2nd together

Dear all,
I've got a ternary function (which is std::find), and
want to bind the first and second parameters (to the
begining and the end of a std::vector). Then send the
result to compose2 to check the equality for the end
of the vector. Here is what I did:
copy_if(istream_iterator<Terminal>(cin),
istream_iterator<Terminal>(),
back_inserter(temp),
compose2(equal

Hossein Haeri wrote:
Dear all,
I've got a ternary function (which is std::find), and want to bind the first and second parameters (to the begining and the end of a std::vector). Then send the result to compose2 to check the equality for the end of the vector. Here is what I did:
copy_if(istream_iterator<Terminal>(cin), istream_iterator<Terminal>(), back_inserter(temp), compose2(equal
(), bind1st(bind1st_3(ptr_fun(f), V_.begin()), V_.end()), V_.end()))); (I've prepared any goodie needed by ternary functions for the above statement: ptr_fun, bind1st_3, ...)
Dev-C++ 4.9.8.0 (GCC 3.3.2 I think), gives me several errors (including "Reference to Reference" problem), and I'm nearly convinced not to continue it this way.
Now, how do you, boost guys, do that?
You probably need
boost::bind(equal

Hi Peter,
copy_if(istream_iterator<Terminal>(cin), istream_iterator<Terminal>(), back_inserter(temp), compose2(equal
(), bind1st(bind1st_3(ptr_fun(f), V_.begin()), V_.end()), V_.end()))); (I've prepared any goodie needed by ternary functions for the above statement: ptr_fun, bind1st_3, ...)
Dev-C++ 4.9.8.0 (GCC 3.3.2 I think), gives me several errors (including "Reference to Reference" problem), and I'm nearly convinced not to continue it this way.
Now, how do you, boost guys, do that?
You probably need
boost::bind(equal
(), boost::bind(f, V_.begin(), V_.end(), _1), V_.end() )
Hmmm..., this is not exactly what I meant. But you made me to search in the Boost for bind, and I found what I wanted. Thanks again, --Hossein __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/
participants (2)
-
Hossein Haeri
-
Peter Dimov