Amumu Amumu - 2 months ago 5x
C++ Question

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

I downloaded the STL source code from , but it only has the .h for the function declaration. Where can I download the .cpp files to read the actual implementation?

For example, in the stl_multimap.h or in stl_map.h, it has:

template <class _Key, class _Tp, class _Compare, class _Alloc>
inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x,
multimap<_Key,_Tp,_Compare,_Alloc>& __y) {

I want to know the actual implementation of the swap as in


I don't see where the actual code for swap is. In here, it just calls itself.


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.