For every character in string

Looping through the characters of a std::string, using a range-based for loop (it’s from C++11, already supported in recent releases of GCC, clang, and the VC11 beta): std::string str = ???; for(char& c : str) { do_things_with(c); } Looping through the characters of a std::string with iterators: std::string str = ???; for(std::string::iterator it = str.begin(); … Read more

How can I loop through a C++ map of maps?

Old question but the remaining answers are outdated as of C++11 – you can use a ranged based for loop and simply do: std::map<std::string, std::map<std::string, std::string>> mymap; for(auto const &ent1 : mymap) { // ent1.first is the first key for(auto const &ent2 : ent1.second) { // ent2.first is the second key // ent2.second is the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)