I downloaded the STL source code from http://www.sgi.com/tech/stl/download.html , 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) {
__x.swap(__y);
}
I want to know the actual implementation of the swap as in
__x.swap(__y);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With