Advertisement Jump to content
Sign in to follow this  
random_thinker

c++ : std::string.find() what is the base algorithm...Boyer-Moore?

This topic is 4889 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just wondering what the std::string.find() algorithm is base upon? Noted in another thread that Boyer-Moore is highly recommended for string finding. Can't find this info in my references or on the 'net. Anyone know? --random_thinker

Share this post


Link to post
Share on other sites
Advertisement
It is implementation-defined. The C++ standard only mandates interface and asymptotic performance, not actual algorithms and implementations. Considering that the full source code for std::string is available, you could check by yourself how your standard library implementation does it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Fruny
It is implementation-defined. The C++ standard only mandates interface and asymptotic performance, not actual algorithms and implementations. Considering that the full source code for std::string is available, you could check by yourself how your standard library implementation does it.


Why do implementations vary, because of the compiler or platform?

--random_thinker

Share this post


Link to post
Share on other sites
Some vendors may want to optimize for code space, others may choose to optimize for runtime performance. New algorithms may come along that are better than old ones, and so on.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
Some vendors may want to optimize for code space, others may choose to optimize for runtime performance. New algorithms may come along that are better than old ones, and so on.


I'm trying to stick with a relatively recent version of g++ (3.3.5). Should the algorithms be more-or-less the same regardless of platform?
--random_thinker

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!