template <class Item>
class bag
{
public:
//TYPEDEF
typedef size_t size_type;
typedef Item value_type;
...
}
,當我使用錯誤:「從屬名稱不是類型」。當類作爲返回值類型定義使用類型,與模板
template<class Item>
bag<Item>::size_type bag<Item>::count(const Item& target) const
VC++報錯爲 Source.cpp(207):警告C4346: '袋:: SIZE_TYPE':依賴名稱不是一種類型
有人可以告訴我爲什麼嗎?謝謝!
的[地點和原因可能重複做我必須把 「模板」 和 「類型名」 關鍵詞?](http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords) – juanchopanza 2013-04-21 13:58:43