My book asked me to create a simple version of a list that held strings.
Here's what I did.
class String_list{
public:
typedef std::string* iterator;
typedef std::string* const_iterator;
typedef size_t size_type;
String_list(){
data = limit = 0;
};
String_list(size_type, std::string);
size_type size() const{return limit - data;};
bool empty() {return data == limit;};
iterator begin(){return data;};
iterator end(){return limit;};
const_iterator begin() const{return data;};
const_iterator end() const{return limit;};
void push_back(std::string);
private:
iterator data;
iterator limit;
};
and it asked me to write a bidirectional iterator for it, but I don't know what to do ... cuz the iterators I am using work like random access iterators since they are pointers to string ... (btw I didn't include the definitions of the constructors/push_back cuz they're working just fine)