2013-10-04 29 views
0

我嘗試使用boost作爲模板變量的鍵爲unordered_map。模板變量作爲unordered_map鍵,迭代器問題

template<typename T> 
std::string CPerformanceWatcher<T>::CheckPerformance(T &sOrderID, bool bDeleteRecord) 
{ 
     boost::unordered_map<T, int>::iterator iter; 
     iter = m_OrderIDTimeValMap->find(sOrderID); 
     if(iter == m_OrderIDTimeValMap->end()) 
     { 
      return false; 
     } 
     return false; 
} 

但編譯抱怨語法錯誤。 所以我的問題是,如果我不能使用這樣一個迭代器?

+0

可能重複[凡爲什麼我必須放置「模板」和「類型名稱」鍵ords?](http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords) – jrok

回答