Sep 24, 2012 at 11:07am UTC
On line 13: change vector<int >::iterator itr;
to vector<T >::iterator itr;
Sep 24, 2012 at 11:09am UTC
This is which i told up.
I changed it and tell me ERROR.
SO WHAT NEED TO DO NOW?
(READ MORE carefully.)
Sep 24, 2012 at 11:11am UTC
typename vector<T>::iterator itr;
Sep 24, 2012 at 11:33am UTC
oww,it works,you are fantastic.
Can tell me now why should put typename?
Sep 24, 2012 at 11:43am UTC
I'm still getting an error. What's the deal?
Sep 24, 2012 at 11:51am UTC
In this case typename
tells the compiler to use template parameter. Otherwise he wouldn't (some do that nonetheless though).
the error is that fn
is declared to return a value but doesn't.
the function can be called so: fn(22,3);
because the compiler has all necessary information to deduce the type.