I have 2 std :: string. I just want, given the input line:
- use every letter
- capitalize the output string.
How it works:
std::string s="hello"; std::string out; std::transform(s.begin(), s.end(), std::back_inserter(out), std::toupper);
but it is not (leads to a program crash)?
std::string s="hello"; std::string out; std::transform(s.begin(), s.end(), out.begin(), std::toupper);
because it works (at least on the same line:
std::string s="hello"; std::string out; std::transform(s.begin(), s.end(), s.begin(), std::toupper);
c ++ string stl transform
sivabudh Sep 28 '09 at 20:53 2009-09-28 20:53
source share