c++模版函数中应用typename 2011年06月21日 1>------ Build started: Project: test_is_Bsearch_postOrderTravel, Configuration: Debug Win32 ------ 1>Compiling... 1>main.cpp 1>e:\c++\test_is_bsearch_postordertravel\main.cpp(6 ) : warning C4346: 'std::vector::iterator' : dependent name is not a type 1> prefix with 'typename' to indicate a type 1>e:\c++\test_is_bsearch_postordertravel\main.cpp(6 ) : error C2061: syntax error : identifier 'iterator' 1>Build log was saved at "file://e:\C++\test_is_Bsearch_postOrderTravel\Deb ug\BuildLog.htm" 1>test_is_Bsearch_postOrderTravel - 1 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 可以正常的编译通过。具体原因可能是编译器不能确定vector::iterator是个类型还是个变量。可能跟编译器的实现有关系。