About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Memb find
Author Message
Brainache Offline
Member

Post: #1
Memb find
if I have a Memb defined as:

Memb<Particles> particles

can i get the index to a member of the Memb by passing in a Particles object?

the memb header shows this...
Int index (TYPE *elm){return _Memb::index (elm);

which would lead me to expect:

Particles p;
int i = particles.find(&p);

to work.. but that is causing errors...

Thanks!
12-17-2009 12:31 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Memb find
Memb::find compares the values (like Particle==Particle)
you should use Memb::index
12-17-2009 05:25 AM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #3
RE: Memb find
but I pass a pointer to the element?
12-17-2009 02:17 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Memb find
yes, Memb::index requires the elements address, and then it checks if the container has an element of that address
12-17-2009 04:12 PM
Find all posts by this user Quote this message in a reply
Post Reply