Home > Archive > VC STL > January 2006 > How to implement a Predicate in 'find' algorithm for finding a rec
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to implement a Predicate in 'find' algorithm for finding a rec
|
|
|
| I've my record set kept with vector, as following:
class _Rec
{
string name;
string phone;
:
string add;
};
typdef vector<_Rec*> m_DateSet;
My problem is how can I use the 'find' algorithm to search for a record
based on the value of arbitrary field, given the field name and the matching
value. And return the iterator of the corresponding record.
Thanks for any suggestion or information to such implementation.
| |
| Ulrich Eckhardt 2006-01-25, 4:17 am |
| Derek wrote:
> I've my record set kept with vector, as following:
>
> class _Rec
> {
> string name;
> string phone;
> :
> string add;
> };
>
> typdef vector<_Rec*> m_DateSet;
>
> My problem is how can I use the 'find' algorithm to search for a record
> based on the value of arbitrary field, given the field name and the
> matching value.
You can't, you need to use find_if instead. Just search the web, hundreds of
examples out there.
Uli
|
|
|
|
|