T
tron.thomas
I have tried the following code on three different compilers and all
three produce programs that hang and fail to complete successfully.
#include <map>
#include <string>
#include <iostream>
#include <iterator>
int main()
{
typedef std::map<int, std::string> Values;
typedef Values::iterator Iterator;
Values values;
values[1] = "one";
values[2] = "two";
values[3] = "three";
values[4] = "four";
values[5] = "five";
Iterator first = values.find(4);
Iterator second = values.find(2);
std::cout << "The distance is " << std::distance(first, second) <<
".\n";
return 0;
}
I did not find any documentation that would indicate this should not
work.
How valid is the use of distance with an SLT map?
three produce programs that hang and fail to complete successfully.
#include <map>
#include <string>
#include <iostream>
#include <iterator>
int main()
{
typedef std::map<int, std::string> Values;
typedef Values::iterator Iterator;
Values values;
values[1] = "one";
values[2] = "two";
values[3] = "three";
values[4] = "four";
values[5] = "five";
Iterator first = values.find(4);
Iterator second = values.find(2);
std::cout << "The distance is " << std::distance(first, second) <<
".\n";
return 0;
}
I did not find any documentation that would indicate this should not
work.
How valid is the use of distance with an SLT map?