2011-06-10 20 views
8

雖然試圖移植一些代碼在Linux中編譯我得到奇怪的編譯錯誤。通過代碼庫搜索,我最終設法將其歸結爲以下代碼。爲什麼不使用boost :: tuple的.get在gcc中的模板函數中工作?

5: // include and using statements 
6: template<typename RT, typename T1> 
7: RT func(tuple<T1> const& t) { 
8:  return t.get<0>(); 
9: } 
10: // test code 

嘗試使用它我得到的錯誤:

test.cpp: In function <functionName>: 
test.cpp:8: error: expected primary-expression before ‘)’ token 

代碼工作在Visual Studio中,但由於某種原因,我想不通爲什麼它不使用g ++工作罰款。這裏的任何人都知道如何解決這個問題?

回答

相關問題