...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <string> #include <locale> void capitalize(std::string &s) { std::locale lloc; s.front() = std::use_facet<std::ctype<char>>(lloc).toupper(s.front()); } |
Compliant Solution
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <string> #include <locale> void capitalize(std::string &s) { if (s.empty()) { return; } std::locale lloc; s.front() = std::use_facet<std::ctype<char>>(lloc).toupper(s.front()); } |
Risk Assessment
...