C
Chris Slominski
I want to pass begin and end iterators to a method. I must not understand
them correctly. In the example below the DoString signature compiles, but
the operations on the passed parameters are not defined.
Thanks,
Chris
#include <iterator>
#include <string>
#include <list>
#include <vector>
using namespace std;
void Tester:oStrings(iterator<forward_iterator_tag, string> begin,
iterator<forward_iterator_tag, string> end)
{
*begin; // undefined operation
++begin; // undefined operation
}
...
{
list<string> myList;
DoStrings(myList.begin(), myList.end());
vector<string> myVector;
DoString(myVector.begin(), myVector.end());
}
them correctly. In the example below the DoString signature compiles, but
the operations on the passed parameters are not defined.
Thanks,
Chris
#include <iterator>
#include <string>
#include <list>
#include <vector>
using namespace std;
void Tester:oStrings(iterator<forward_iterator_tag, string> begin,
iterator<forward_iterator_tag, string> end)
{
*begin; // undefined operation
++begin; // undefined operation
}
...
{
list<string> myList;
DoStrings(myList.begin(), myList.end());
vector<string> myVector;
DoString(myVector.begin(), myVector.end());
}