Sep 16, 2013 at 1:06pm UTC
#include <vector>
template <typename T>
class Vector
{
private:
int _size; //Slots used.
int _capacity; //Total capacity.
T *_store; //To store the items array
public:
Vector() //Do I need to insert arguments like (size, cap, *store)???
{
...
}
int main() {
vector<int> intV;
Vector intV(); //Doesn't work.
OR
Vector (vector<int> intV); //Tried setting arguments into constructor.
return 0;
}
I'm always missing template arguments before intV???
Last edited on Sep 16, 2013 at 1:10pm UTC
Sep 16, 2013 at 1:16pm UTC
Vector is a template class. When you instantiate it, you need to instantiate it for a specific type - in exactly the same way as you would for a std::vector .
Sep 16, 2013 at 1:18pm UTC
I see thanks.
For others who may view this:
Just needed to do this:
Vector<T> ()