Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <boost/bind.hpp>
- #include <vector>
- #include <algorithm>
- struct T
- {
- int a;
- float b;
- long c;
- };
- int main ()
- {
- std::vector<T> items;
- T t;
- for (int i = 0; i < 10; ++i)
- {
- t.a = i + 10;
- t.b = i*30.5;
- t.c = -i;
- items.push_back(t);
- }
- std::vector<T>::iterator it = std::find_if(items.begin(),items.end(),boost::bind(&T::a,_1) == 13);
- if (it != items.end())
- std::cout << "a = " << it->a << " b = " << it->b << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement