U++ framework
Do not panic. Ask here before giving up.

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: Thu Sep 03 07:19:45 GMT+2 2026

Total time taken to generate the page: 0.00688 seconds