Monday, March 05, 2007

stl in gnu / gcc

Listening to : Werefrogs, "Forest of Doves"


So i wanted to use the stl pair and couldn't remember how to include it in ( #include < pair > didn't compile ) and I found out that in gcc334 pair is deprecated, but still available via #include < bits/stl_pair.h >


then use it with the std namespace as per usual.


The other one that's slightly different is hash_map, which is part of the extension.
Include it like this;


#include < ext/hash_map >


and use it with the __gnu_cxx namespace
like this


__gnu_cxx::hash_map < int,double > X;


voila!


(oh and by the way these should be automatically included by gcc, no need for -I in your makefile or anything)