C++ standard library vs mortal made code + where can I find the sources?
<p>Two, maybe trivial questions:</p>

<h2> 1. Why can not I beat the STD functions?</h2>

<p>Really. I spent the last three days implementing something faster than std::sort, just for the sake of doing it. It is supposed to be an introsort, and I suspect it uses the single pivot version quicksort inside. Epic fail. Mine was at least twice as slow.</p>

<p>In my utter bitterness I even copy-pasted other - top notch - programmers code. No avail.
I benchmarked my other algorithms too... My binary search, and upper_bound, lower_bound versions are so stripped down it couldn't really be made with less instructions. Still, they are about twice as slow.</p>

<p>I ask, why, why, why? And this leads me to my next question...</p>

<h2>2. Where can I find the source code of the STL library functions?</h2>

<p>Of course, I want to look at their sources! Is it even possible to write more efficient code than those, or am I at an abstraction level with my "simple" main.cpp where I can not reach optimisations utilized by the STL library?</p>

<p>I mean for example... Let's take the maps... wich are simple associative containers. The documentation says it is implemented with a red-black tree. Now... would it worth it to try implement my own red-black tree, or they took this joy :-) away from me and I should just throw every data I get my hands on into the map container?</p>

<p>I hope this does make sense.
If not, please forgive me.</p>

<hr>
