Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Predicate with argument

Reply
Thread Tools

Predicate with argument

 
 
Christopher
Guest
Posts: n/a
 
      02-05-2009
How do I use std::find_if with a predicate that takes an argument?

For example,
If I have a vector of pointers to classes that contain ints
I want to search for the first occurence a class containing, the
number 7
Later, I want to search for the first occurence of a class in the same
vector, containg the numer 5
Where the number is the argument I want to pass to the predicate

In my real code the argument is a string
The vector contains smart pointers to classes that contain a string
amongst other things.

I am searching for the first occurence that have one string
Then I am changing the string and searching.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Predicate with argument Ian Collins C++ 3 02-05-2009 10:25 PM
XPATH Predicate Syntax question Sabba XML 0 05-09-2006 10:48 AM
get position after spec. predicate awebguynow XML 1 01-27-2006 08:42 AM
Predicate by attribute? Jacques XML 2 06-24-2004 11:45 AM
Help with template find_if predicate mikets C++ 18 01-07-2004 02:36 PM



Advertisments