Given string foo
, I've written answers on how to use cctype
's tolower
to convert the characters to lowercase
transform(cbegin(foo), cend(foo), begin(foo), static_cast<int (*)(int)>(tolower))
But I've begun to consider locale
's tolower
, which could be used like this:
use_facet<ctype<char>>(cout.getloc()).tolower(data(foo), next(data(foo), foo.size()));
- Is there a reason to prefer one of these over the other?
- Does their functionality differ at all?
- I mean other than the fact that
tolower
accepts and returns anint
which I assume is just some antiquated C stuff?