I'm very uneasy when it comes to coding STL. I am ok using STL functions and STL container's etc, in main, but I now need to create my own template. Here is what I'm asked to do, and yes it is homework:

Write a template container class, Pos_Neg_Array. This is an array class where the elements in the array can be indexed using positive or negative values. When insertions are done, the array can grow in either the positive or negative direction. The element in position 0 is not affected by insertion or deletion (except when done at that position). Your class must work with the existing STL code. You should look at the interface for the vector class to see what the structure of your class should be. You must write a test program for the class.

I can't seem to figure out where to start.

For starters how do you write a template container class?
How do I go about creating an array class as a template container class?
If the class must work with the existing STL code, doesn't that just mean we write it in STL?
Where can I find the interface for the vector class?

I'm really not asking for code, other then the interface for the vector class. What i'm stumbling on is understanding the project.

Thank You,

10 Years
Discussion Span
Last Post by ~s.o.s~
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.