Hello guys,
I've made a function template that will create a vector of whatever variable type is passed to it, it works great with ints and doubles, but fails to create a vector of strings. If anyone can give me any pointers on what is wrong with this code it sure would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13
template <class D>
vector<D> get_vect(int iter, D)
{
D temp_d;
vector<D> temp_v;
for (int i = 0; i < iter; i++)
{
cout << "Enter " << i + 1 << endl;
cin >> temp_d;
temp_v.push_back(temp_d);
}
return temp_v;
}