Using FirstThat function with list containers

Has anyone any example clue about using the FirstThat function with a list container such as TSListImp on Borland C++.
sagitarianAsked:
Who is Participating?
 
md041797Connect With a Mentor Commented:
If memory serves:


int CondFunction (const obj &o, void *p) {
  o.testIt (p);
  }

int obj::testIt (void *p) {
  return *(int *)p == 5; // or whatever
  }

TSListImp <obj> list;
...
int testval = 4;
const obj &TheFirstItem = list.FirstThat (CondFunction, &testval);


0
 
sagitarianAuthor Commented:
Would just need an opinion on the global program construction.
Maybe, most of the time, the function 'CondFunction' is very specific to the function from which it is called.
Haven't seen yet a better way to arrange the program.
0
 
md041797Commented:
Yes, that's the intent.  It allows the object to do it's own testing.
0
 
sagitarianAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.