Created
December 31, 2011 08:38
-
-
Save allen501pc/1543405 to your computer and use it in GitHub Desktop.
在template中使用typename
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
class A{ | |
public: | |
T m_A; | |
void funcTest() | |
{ | |
map<T , int> mapTempTable; /* 這部分沒問題, OK! */ | |
/* 編譯器會出錯! | |
要改成 typename map<T, int>::iterator it; */ | |
map<T, int>::iterator it; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment