I am trying to compile with g++ 4.4 and link a simple program that uses the STL. I am trying to do it using the -fno-implicit-templates so all templates must be instantiated explicitly.
I don't understand why this code works:
#include <map>
//template class std::map<char,char>;
template class std::_Rb_tree<char, std::pair <char const, char>,
std::_Select1st<std::pair<char const, char> >,
std::less<char>, std::allocator<std::pair<char const, char> > >;
int main() {
std::map <char,char> table;
return 0;
}
I would expect that this program needs the line: template class std::map<char,char>;
, however that line does not make the program link. The std::_Rb_tree line
is needed. Why?
Thanks in advance, any hint will be appreciated.