-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*

aを作成vectorするvector<int*>か、テンプレートにを作成しますvector<T>

于 2013-02-10T02:10:48.400 に答える