Where to download C++ STLsource code both .h and .cpp files?

The .h files contains the implementations. Many of the headers on that page are just wrappers around other headers or provide typedefs, but if you look at a file like stl_set.h, you will see that it has all the definitions of functions for the set class.

Even the page itself states that it is a header-only library, which means that the implementations are included in the headers.


The implementation of the C++ library varies on different compiler/system. If you are using GCC/G++ as your compiler, here you can download the source code from http://gcc.gnu.org/libstdc++/ .

Or you can anonymously checkout the source code using this command:

svn checkout svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3 libstdc++

STL is a template library. I hope you will find the implementation in header files only.

Tags:

C++

Stl