For an assignment I am supposed to recreate the C++ Vector library, and I am currently stuck on how to return maximum size.
According to this website: http://www.cplusplus.com/reference/stl/vector/ size_type max_size () const; Return maximum size
Returns the maximum number of elements that the vector container can hold.
Currently my functions are based on the manipulation of arrays and the vector library is not based on a template class, the vector library uses the int and size_t data-types. (I am unsure whether this has any bearing on it)
Relevant code:
class vector{
private:
int *vect;
size_t length;
size_t cap;
public:
//=====================Constructor================
vector(){
length = 0;
cap = 20;
vect = new int[20];
}
//INCOMPLETE
size_t max_size() const{
//return???!?!?!?!?
}
}