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
Re: GetIndex on Array [message #11705 is a reply to message #11700] Sun, 23 September 2007 10:36 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14265
Registered: November 2005
Ultimate Member
Yes, actually, "GetIndex" is an idea that looked intereseting at the time Array was first created, but turned out to be not so good idea later... (that is why it is not even documented, but once you introduce a method, it is hard to remove... but in fact, it should be removed).

Anyway, what you need you can get using FindIndex "algorithm" function, like

int i = FindIndex(a, "pluto");


anyway, be warned, this is linear search.

If you want this fast, use Index (which OTOH has very slow Remove).

Mirek
 
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: Tue Jul 15 08:09:58 CEST 2025

Total time taken to generate the page: 0.03341 seconds