cpp std::string words = "mAn OF stEEL";
std::vector<std::string> swv;
boost::split(swv, words, boost::is_any_of(" "));
std::string newwords = (std::for_each(swv.begin(), swv.end(), StringTAndJ(WordToCaps))).value();
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>
#include "boost/algorithm/string.hpp"
typedef void(*Func)(std::string&);
struct StringTAndJ
{
StringTAndJ(Func func = NULL, const std::string& sep = " ") : func_(func), sep_(sep) {}
void operator()(std::string& s) { if (func_) func_(s); word_.append(s).append(sep_); }
std::string value() { return word_; }
Func func_; std::string word_, sep_;
};
void WordToCaps(std::string& s)
{
std::transform(s.begin(), s.end(), s.begin(), std::tolower); s[0] = std::toupper(s[0]);
}
int main()
{
std::string words = "mAn OF stEEL";
std::vector<std::string> swv;
boost::split(swv, words, boost::is_any_of(" "));
std::string newwords = (std::for_each(swv.begin(), swv.end(), StringTAndJ(WordToCaps))).value();
}