'std::vector::iterator it;' doesn't compile

前端 未结 2 820
北恋
北恋 2021-02-18 23:12

I\'ve got this function:

    template
    void Inventory::insertItem(std::vector& v, const T& x)
    {
        std::vector<         


        
2条回答
  •  轮回少年
    2021-02-18 23:43

    Try this instead:

    typename std::vector::iterator it;
    

    Here's a page that describes how to use typename and why it's necessary here.

提交回复
热议问题