🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #79

Help! How do I use the forEach method in Borland's Bag class?

#79
From: David Charlap
Date: Mon, 02 Nov 1992 03:09
25 lines
1640 bytes
A am using Borland C++ 3.1 for Windows.  I managed to declare an
object of type Bag to store assorted objects in.  Now, I want to call
a certain member function (the paint method) on each object in the
bag.  The only help the manual gives is:

>Bag::forEach
>
>void forEach(void ( *actionFuncPtr)(Oject& o, void *), void *args);
>
>See also: Container::forEach, which states:
>
>virtual void forEach( iterFuncType actionFuncPtr, void *args );
>
>forEach creates an internal iterator to execute the given action
>function for each element in the container.  The args argument lets
>you pass arbitrary data to the action function.

This is all the books say.  Has anyone succerssfully used this
command?  Could someone post a simple example?  Thanks.

-- 
David Charlap         |"there aren't 50,000 things for which it's worth writing
dic5340@hertz.njit.edu| software; and the computer industry doesn't have enough
----------------------+ programmers to create that much good software.
Therefore, most of it must be worthless" -- Boris Beizer "The Frozen Keyboard"
Technical Details
Message-ID: <1992Nov2.030927.14309@njitgw.njit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!uwm.edu!cs.utexas.edu!sun-barr!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!uwm.edu!cs.utexas.edu!sun-barr!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
From: dic5340@hertz.njit.edu (David Charlap)
Newsgroups: comp.os.msdos.programmer,comp.os.ms-windows.programmer.tools,comp.os.ms-windows.programmer.misc
Subject: Help!  How do I use the forEach method in Borland's Bag class?
Message-ID: <1992Nov2.030927.14309@njitgw.njit.edu>
Date: 2 Nov 92 03:09:27 GMT
Sender: news@njit.edu
Organization: New Jersey Institute of Technology, Newark, N.J.
Lines: 25
Nntp-Posting-Host: hertz.njit.edu