I am making a library using the data structure: std::vector<std::string>. I have to satisfy the API, which says that in order to iterate through my data structure users would have to do the following:
for (lib::result::const_iterator it = data.begin(); it != data.end(); it++)
There are two ways I could do this, implement lib::result::const_iterator on my own or inherit from std::vector<std::string>::iterator, they should both work. I have read that inheriting from the vector iterator is a bad idea.
I have decided to use Boost iterator facade, is this a good idea?
Also, I am having trouble implementing increment(). If I have a pointer to a string in an std::vector, how do I point to the next string?
Lastly, my implementation could change from std::vector<std::string>, to std::vector<MyDatatype>, so I would like to use the boost facade so if ever I decide to make changes to my data structure, things would be easier.
Thanks.
typedefit