Performance comparison: strstr() vs std::string::find()

Can someone please explain why I should use strstr or string find() ? Which one is faster, at where ?


In C++ you should use std::string::find(), in C you should use strstr(). The difference in performance should not be significant.


It doesn't matter which is faster. Much more important is that the std::string::find is safe. So use std::string class and avoid old c functions, if you are going to use c++.