-1

我收到一个编译器错误,上面写着

could not deduce template argument for 'std::vector<T*>&' from 'std::vector<_Ty>'

template <typename T> void foo(vector<T*>& a, int left, int right)
{
     ...
}

main()
{
     ...
     //declare and instantiate 3 vectors
     vector<int> intVector;

     foo(intVector, 0, 100);
     foo(doubleVector, 0, 100);
     foo(charVector, 0, 100);
     ...
}
4

1 回答 1

0

int无法匹配T*

要么制作vectoravector<int*>要么制作模板 take vector<T>

于 2013-02-10T02:10:48.400 回答