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 » [solved] Why doesn't Vector have Find?
Re: Why doesn't Vector have Find? [message #45569 is a reply to message #45565] Fri, 04 December 2015 19:43 Go to previous messageGo to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

There is a common Find() template to achieve what you want. It is applied to a number of containers, not only Vector.
But I doubt if slow sequential search is a good idea at all. If you want Vector and you want to have quick search, make it sorted. Add items by using FindUpperBound()-like calls, then you may search with FindBinary() which costs O(log(n)), not O(n) as for sequential search.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Time in milliseconds
Next Topic: IntStr function returns an empty string
Goto Forum:
  


Current Time: Sun Jul 06 03:34:06 CEST 2025

Total time taken to generate the page: 0.03093 seconds