why is there a need of two arguments,forwardIterator and class T,can’t we just complete the task with just one argument?
Iterators Example
And what is the only argument that you want to pass?
like just class T perhaps
The issue then will be knowing about the bounds of the container where we want to search.
That was the actual work of forward and end iterators.
Ohh are you talking about the template parameter??
I guess, I got you wrong. Can you please point out the exact doubt for me?
yes I was talking about the template parameters,i.e class forwardIterator and class T
Ohh okay!
Well it is because we don’t know of what type the forwardIterator will be of, so we just define a template for it.
This is same as defining T, because we don’t know about the type of T.
then why did we just keep n as int data type when we were making the template function for linear search
Because it was used to denote the size, which is definitely int.