I'm trying to figure out how to use a generic function template to simply return a vector array of ints or doubles or whatever else I want.
Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12
template <typename T>
std::vector<T> myVec(T s, T e, T v)
{
std::vector<T> C;
for (s; s <= e; s += v) { C.push_back(s); }
return C;
}
main()
{
std::vector<int> V = myVec<int>(1,10,1);
}
It gives me a linker error to this function when it compiles. Can anyone please help?