16 const std::string& str, std::string::size_type limit) {
17 std::vector<std::string> out;
18 if (limit == 0)
return out;
20 std::string::const_iterator it = str.begin(), last = it;
22 for ( ; it != str.end(); ++it)
24 if (*it ==
' ' || *it ==
'\n' || *it ==
'\t' || *it ==
'\r')
31 if (out.size() + 1 >= limit)
33 out.emplace_back(last, str.end());
37 out.emplace_back(last, it);
43 out.emplace_back(last, it);
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
std::vector< std::string > split_words(const std::string &str, std::string::size_type limit)
Split the given string by whitespaces into distinct words.