Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ames!ncar!tank!uxc!uxc.cso.uiuc.edu!a.cs.uiuc.edu!p.cs.uiuc.edu!johnson From: johnson@p.cs.uiuc.edu Newsgroups: comp.lang.c++ Subject: Re: Emulate elementsPerform:with: metho Message-ID: <77300013@p.cs.uiuc.edu> Date: 10 Oct 88 12:32:00 GMT References: <3287@tekig4.TEK.COM> Lines: 11 Nf-ID: #R:tekig4.TEK.COM:3287:p.cs.uiuc.edu:77300013:000:575 Nf-From: p.cs.uiuc.edu!johnson Oct 10 07:32:00 1988 >I would like to send a message to each element on a list of objects. >I'd also like the message to be an argument that I give to the routine >that does the sending. This emulates the action of the Objective-C >elementsPerform:with: method. So far, I can't see a way to do this >using, for instance, pointers to member functions. Assumeing that you have a list of objects of classes that are subclasses of T, you can pass in a function on objects of T that sends the message. The routine that does the sending will then evaluate the function for each element of the list.