I try to find a way to find the minimum of an array of numbers different type (int,float,double..)
i have written this
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
template <class T>
T min(vector<T> a())
{
int i = 0;
T min = a[0];
vector<int>::iterator it;
for( it = a.begin(); it!=a.end(); ++it)
{
if((*it)<a[i++])
min = *it;
}
return min;
}
int main()
{
vector<int> b(10);
for(int i = 0;i<b.size();++i)
b[i] = i + 2;
cout<<min(b)<<endl;
return 0;
}
I get this Error:
main.cpp: In function `int main()':
main.cpp:31: error: no matching function for call to `min(std::vector<int, std::allocator<int> >&)'
anyone knows what i'm doing wrong???