
October 13th, 2002, 10:37 AM
|
|
Contributing User
|
|
Join Date: Jul 2002
Location: Tallahassee
Posts: 55
  
Time spent in forums: 2 h 57 m 51 sec
Reputation Power: 12
|
|
Implemenation of <vector> class function, PushBack()
Hey all,
For any of you that is familar with the <vector> class, I need to ask you a huge favor. For my HW, I need to write a 'cheap imitation' version of the vector class except my version is going to be called TVector. It's protected data member include size and capacity and also a method name newarray() that acts as a safe space allocator. This imitation vector class like the real one, is a generic template.
My assignment is to implement my version of the PushBack() method for the vector class(without using any other classes).
The prototype will look like so:
Code:
int PushBack(const T&);
//We increase size by one and insert a copy of the parameter value into newly allocated vector element.
//What if size cannot be increased without increasing capacity
Can anyone with an in-depth knowledge of STL help me with this?
|