
"Peder Holt" <peder.holt@gmail.com> wrote
Then again, the following compiles with VC7.1, so maybe there is hope after all :)
Wow... The reason it compiles is that you are using "class" where I used "typename". The following does not work: template<typename A0> void deduce_container(*typename* std::_Tree<A0>::iterator) { std::cout << "map" << "\n"; } I don't think this is a legal standard usage, though... Probably a Microsoft - specific "feature"... Any comments from language experts? Should the following work according to the Standard?
#pragma warning (disable:4786) #include <map> #include <list> #include <iostream>
template<typename A0,typename A1> void deduce_container(class std::list<A0,A1>::iterator) { std::cout << "list" << "\n"; }
template<typename A0> void deduce_container(class std::_Tree<A0>::iterator) { std::cout << "map" << "\n"; }
int main() { std::map<int,double>::iterator a; std::list<int*>::iterator b; deduce_container(a); deduce_container(b); return 0; }
Arkadiy