OK, I'm usually pretty good at translating this STL nonsense into English, but this time I'm stumped.
How in the world do I use the iterator template?
I want to create my own Directory Iterator class and rather than reinvent the wheel, I wanted to use the STL iterator, but both the MSDN and my books are quite useless. I don't know how to add items into the iterator.
Here's what I have so far:
In the CDirectoryIterator constructor I was thinking of adding the files to the iterator, but I don't see anything that would allow me to do: this->push_back( dirItem );
Also, what are the iterator template parameters used for? Somehow I get the feeling that <CDirectoryItem, CDirectoryItem> isn't quite right.
How in the world do I use the iterator template?
I want to create my own Directory Iterator class and rather than reinvent the wheel, I wanted to use the STL iterator, but both the MSDN and my books are quite useless. I don't know how to add items into the iterator.
Here's what I have so far:
Code:
class CDirectoryIterator : public not_copyable,
public std::iterator<CDirectoryItem, CDirectoryItem>
{
public:
CDirectoryIterator( const char* pszDirectory,
const char* pszFileMask = NULL,
bool searchSubDirectories = false );
virtual ~CDirectoryIterator();
private:
CDirectoryIterator();
};
Also, what are the iterator template parameters used for? Somehow I get the feeling that <CDirectoryItem, CDirectoryItem> isn't quite right.