c++ - ::tolower vs std::tolower difference -
this question has answer here:
- what “::” mean in “::tolower”? 4 answers
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
Post a Comment