Hi,
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:
It gives me a linker error to this function when it compiles. Can anyone please help?
Thank you.
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:
- 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?
Thank you.