Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » GetIndex on Array
GetIndex on Array [message #11700] Sat, 22 September 2007 18:36 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Trying this code :

Array<String> a;
a << "pippo";
a << "pluto";
a << "gigi";
int i;
i = a.GetIndex("pluto");

i is -1, so no item is found in array.... is it a bug or do I miss something ?
I've seen that using Index and Index.Find() it does work, but Index is not sorteable.

Regards

Max

EDIT : Looking into Array code, I've seen that GetIndex looks only for address of contained element, not for the element itself. So it's useful only for pointers, not for elements for whom the operator== is defined.... A function to locate an element by value is missing.

[Updated on: Sat, 22 September 2007 18:40]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 2 small Bugs [bug]
Next Topic: Transfer Semantics - Initializer list and copy constructors
Goto Forum:
  


Current Time: Wed Apr 24 07:05:26 CEST 2024

Total time taken to generate the page: 0.02817 seconds