I have
using namespace std;
vector<char> tmp;
tmp.push_back(val);
...
Now when I try
transform(tmp.begin(), tmp.end(), tmp.begin(), std::tolower);
It fails to compile, but this compiles:
transform(tmp.begin(), tmp.end(), tmp.begin(), ::tolower);
What's the problem with std::tolower
? It works with one argument, e.g., std::tolower(56)
compiles. Thanks!
std::tolower
has two overloads and it cannot be resolved for the UnaryOperation
where the C version ::tolower
does not.
If you want to use the std::tolower
you can use a lambda as
transform(tmp.begin(), tmp.end(), tmp.begin(), [](unsigned char c) {return std::tolower(c); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With