template <class T>
class VectorRemake
{
private:
T* list[];
int count;
int capacity;
public:
VectorRemake() :capacity(DEFAULT_CAPACITY) :count(0) {list = new T[capacity];}
VectorRemake(int capacity) :capacity(capacity) :count(0) {list = new T[capacity];}
~VectorRemake() {delete [] list;}
...
}
I'm not sure what i'm doing wrong here. It's the constructors that cause the problems.
void resize(int size, T t=T())
{
if (size < capacity)
{
for (int i = size; i < capacity; i++)
T[i] = 0;
count = size;
}
else if(size > capacity)
{
T *newlist = new T[size];
for (int i = 0; i < count; i++) newlist[i] = list[i];
for (int i = count; i < size; i++) newlist[i] = t;
delete [] list;
list = newlist;
}
else return;
capacity = size;
}
I'm getting 4 errors @T[i] = 0; (6th line).
I'm trying to set it to NULL, but my instructor told me that NULL isn't a c++ standard, what should I be doing?
Warning 1 warning C4091: '' : ignored on left of 'double' when no variable is declared 3\solution11-3\solution11-3.cpp 46
Error 2 error C2143: syntax error : missing ';' before '['
Error 3 error C2337: 'i' : attribute not found
Error 4 error C2143: syntax error : missing ';' before '='