Predicate with argument

Discussion in 'C++' started by Christopher, Feb 5, 2009.

  1. Christopher

    Christopher Guest

    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.
     
    Christopher, Feb 5, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacques

    Predicate by attribute?

    Jacques, Jun 24, 2004, in forum: XML
    Replies:
    2
    Views:
    381
    Jacques
    Jun 24, 2004
  2. awebguynow
    Replies:
    1
    Views:
    364
    George Bina
    Jan 27, 2006
  3. Sabba
    Replies:
    0
    Views:
    636
    Sabba
    May 9, 2006
  4. mikets
    Replies:
    18
    Views:
    1,161
    Chris \( Val \)
    Jan 7, 2004
  5. Ian Collins

    Re: Predicate with argument

    Ian Collins, Feb 5, 2009, in forum: C++
    Replies:
    3
    Views:
    356
    Christopher
    Feb 5, 2009
Loading...

Share This Page