#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
template <typename T>
class Iterator
{
public:
typedef typename T::iterator IterType;
Iterator(T& source) :
begin(source.begin()),
end(source.end()),
current(begin)
{
}
bool hasNext() const
{
return current != end;
}
IterType next()
{
return current++;
}
private:
IterType begin;
IterType end;
IterType current;
};
int main()
{
vector<string> temp;
temp.push_back("Some text 1");
temp.push_back("Some text 2");
Iterator<vector<string> > iter(temp);
while(iter.hasNext())
{
cout << *iter.next() << endl;
}
string temp2 = "another test string";
Iterator<string> iter2(temp2);
while(iter2.hasNext())
{
cout << *iter2.next() << endl;
}
}