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
Post a Comment