May 13, 2017 at 12:47pm UTC
Hi,
I wrote the following code for testing
1 2 3 4 5 6
std::map<std::string, std::string> test;
test["realname" ] = "abc" ;
unsigned int row(0);
for (auto const &item: test) {
std::cout << userData.size() << "/" << row << std::endl;
}
But this loop is never ending. When I compile and run it, the output should be only one line. but after maybe 10000 lines output i stop it.
Does anyone know why?
Greetings torsten
Btw, I'm not able to format (with firefox) this message
Last edited on May 13, 2017 at 12:48pm UTC
May 13, 2017 at 1:28pm UTC
It works fine for me.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
#include <map>
int main()
{
struct { int size() { return 0; } } userData;
std::map<std::string, std::string> test;
test["realname" ] = "abc" ;
unsigned int row(0);
for (auto const &item: test) {
std::cout << userData.size() << "/" << row << std::endl;
}
}
0/0
Are you sure the problem is caused by the code that you have posted?
Last edited on May 13, 2017 at 1:29pm UTC
May 13, 2017 at 1:37pm UTC
Mhm... I only did copy and paste it from my code, and there I become this error. Only two things are different: The loop runs in a lib and the application is based on a framework that uses boost threads. Maybe one of them is the reason. I'll try it out.
But thanks.
May 14, 2017 at 10:09am UTC
Seems like it was the main application. After I did recomplile that, it works. Thank you.