|
From: Ioannis V. <iv...@em...> - 2003-07-01 05:21:30
|
> -----Original Message-----
> From: Ioannis Vranos [mailto:iv...@em...]=20
> Sent: Monday, June 30, 2003 7:55 PM
> To: 'Dev-C Mailing List'
> Subject: RE: [Dev-C++] Reverse Map lookup.
>=20
>=20
> > -----Original Message-----
> > From: dev...@li...=20
> > [mailto:dev...@li...] On Behalf=20
> > Of David McKen
> > Sent: Monday, June 30, 2003 6:27 PM
> > To: Dev-C Mailing List
> > Subject: [Dev-C++] Reverse Map lookup.
I had better tell you how you will do it:
// Assuming you have stored function addresses in void *.
map<string, void *>whatever;
Let's assume you are looking for a specific address to find the string.
A map iterator consists of a pair<R,T> which is a struct having 2 =
pointers,
first and last, first potining to the first elemenet (key) and last=20
whichh points to the second.
// Target value
void *tval=3Dsomething;
for(map<string, void *>const_iterator p=3Dwhatever.begin(); =
p!=3Dwhatever.end();
++p)
{
// You found the val
if(p->last=3D=3Dtval)
//do whatever you want to do with p->first
}
I hope this helps David.
Ioannis Vranos
=20
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net
|