c++ - :: operator necessary to use with tolower()? -


transform(mystr.begin(), mystr.end(), mystr.begin(), tolower); 

i using transform function make string lowercase letters, after writing "using namespace std;" @ top of program whole bunch of errors(when writen above). when include :: operator before tolower parameter (such below) don't. why this? thought tolower function in std namespace , work have above.

transform(mystr.begin(), mystr.end(), mystr.begin(), ::tolower); 

i have following includes:

#include <iostream> #include <fstream #include <sstream> #include <algorithm> #include <vector> 

in error message see:

error: no matching function call 'transform(std::basic_string<char>::iterator, ... 

then place 'tolower' in parameter list

, <unresolved overloaded function type>);' 

it's resolve conflict between overloads of tolower between <cctype>'s int tolower(int c) , <locale>'s template <typename chart> chart tolower(chart c, locale const& loc)

::tolower use of global scope


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -