c++ - ::tolower vs std::tolower difference -


this question has answer here:

i have

using namespace std; vector<char> tmp; tmp.push_back(val); ... 

now when try

transform(tmp.begin(), tmp.end(), tmp.begin(), std::tolower); 

it fails compile, compiles:

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

what's problem std::tolower? works 1 argument, e.g., std::tolower(56) compiles. thanks!

std::tolower has 2 overloads , cannot resolved unaryoperation c version ::tolower not.

if want use std::tolower can use lambda as

transform(tmp.begin(), tmp.end(), tmp.begin(), [](unsigned char c) {return std::tolower(c); }); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -