Now it's time flesh out the class, and consider the interface we'd like to give it.
First, STL containers have a number of requirements, laid down in the C++ standard in section 23.1. This includes definitions for these nested type definitions:
- value_type - type of the items help in the container
- reference - type of a reference to an item in the container
- const_reference - type of a reference to a constant item in the container
- iterator - type of container iterator
- const_iterator - type of container const interator
- difference_type - type expressing the distance between two iterators (or const_iterators)
- size_type - type that represents any non-negative value of difference_type
This is a starting point. We'll define the iterator types later, and some of these definitions can be made a little more elegant, too.typedef T value_type;
typedef size_t size_type;
typedef int difference_type;
typedef value_type &reference;
typedef const value_type &const_reference;
Next time: we'll decide the mechanics of the class and how to manage resources.