I was wondering how often people actually use much of the standard c++ library, particularly the stuff in the
and
It's possible you're being lazy or stubborn. Personally, I use them all the time in production code.
I don't do this to be fancy, and I don't do this because I like writing "space-age code." Rather, I do this because I am a paranoid programmer, and I know that production environments are hostile places that will mutilate code and reduce my programs to smoking piles of worthless bytes, if given a chance.
I do this because I live by the motto, "The best code, is the code you never write." It takes time to learn how to use the STL & Std Lib effectively, but once you do you'll find that it can be used so that what now is 1000 lines of code becomes perhaps 100. Those 100 might take as long to write as the original 1000, but there are fewer failure points. The code can be more robust, if you stand on the shoulders of others.
Just about everyone using C++ uses the STL, especially <algorithm>
. You really don't want to have to write sorting functions yourself; you'll just end up making mistakes, and in the end the performance will probably be worse.
Whether or not there are performance gains obviously depends on what you are comparing to. In general though, using the STL algorithms is typically faster than writing your own functions -- unless you happen to have a particular trick that applies to your use case that could give you the edge. If you just write a standard quicksort yourself, it will probably be slower than the one in the STL.