Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using FirstThat function with list containers

Posted on 1997-07-01
4
Medium Priority
?
288 Views
Last Modified: 2006-11-17
Has anyone any example clue about using the FirstThat function with a list container such as TSListImp on Borland C++.
0
Comment
Question by:sagitarian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
md041797 earned 280 total points
ID: 1164209
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
 

Author Comment

by:sagitarian
ID: 1164210
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
 
LVL 4

Expert Comment

by:md041797
ID: 1164211
Yes, that's the intent.  It allows the object to do it's own testing.
0
 

Author Comment

by:sagitarian
ID: 1164212
Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question