Discussion:
problems making a function that takes in a vector
(too old to reply)
bob
2005-04-28 03:11:04 UTC
Permalink
error C2955: 'vector' : use of class template requires template argument
list
rror C2670: 'foward' : the template function cannot convert parameter 1 from
type 'class std::vector<int,class std::allocator<int> > (void)'
Error executing cl.exe.
counter=foward(&storage , &infile ,counter);
int foward(vector &pages , ifstream &infile, int counter){

im trying to make a function that takes in a vector but im having problems
with it
bob
2005-04-28 07:10:47 UTC
Permalink
the problems are currently with the the function itself.
Post by bob
error C2955: 'vector' : use of class template requires template argument
list
rror C2670: 'foward' : the template function cannot convert parameter 1
from type 'class std::vector<int,class std::allocator<int> > (void)'
Error executing cl.exe.
counter=foward(&storage , &infile ,counter);
int foward(vector &pages , ifstream &infile, int counter){
im trying to make a function that takes in a vector but im having problems
with it
Jeff Ford
2005-04-28 13:14:14 UTC
Permalink
Post by bob
error C2955: 'vector' : use of class template requires template argument
list
int foward(vector &pages , ifstream &infile, int counter){
You can't ever have an object whose type is just vector. It always has to
be vector<something>. If you want to write a function that works for all
types of vectors, you have to write a templated function, but in this case
you probably just want to use vector<int>.

Jeff
--
Jeff Ford http://www.cs.utexas.edu/users/jeffford/
Loading...