   Can this be more concise
  Just wanted to see, if you could help me make this function more concise.vector<string> split(const string& text,const char sub ){string textCopy(text);replace_if(textCopy.begin(),textCopy.end(),EqualCheck<char>(sub),' ');stringstream ss(textCopy);vector<string> words;std::copy(istream_iterator<string>(ss),  istream_iterator<string>(),  back_insert_iterator<vector<string>>(words)  );return words;}EqualCheck is an appropriate template function. Thatn given an arg, checks if subis equal to it. I was thinking maybe we could combine all of those, into a std::transform or something.   
  There's a fundamental flaw with your algorithm:  What if you want to split by commas, but not spaces?  Your algorithm would split by both.  Anyway, if you're already using stringstream, you might as well take advantage of getline's delimiter parameter:vector<string> split( const string& str, char delim ) {vector<string> result;string token;stringstream ss( str );while ( ss && getline( ss, token, delim ) )result.push_back( token );return result;}Test run and output.This will also help to avoid an extraneous copy of the string being passed in by avoiding the making of a modifiable copy of the the string.Also, instead of writing your own EqualCheck, you can use bind1st( equal_to<char>(), sub );  [smile]   ;  Boost makes it easier and more flexible:std::vector<std::string> split(const std::string & text, const char * delims){    typedef boost::char_separator<char> delimiter;    boost::tokenizer<delimiter> tokens(text, delimiter(delims));    return std::vector<std::string>(tokens.begin(), tokens.end());}Usage: std::vector<std::string> toks = split("1,2,3:4[5],6 7 8#9 10", ", :[]#");Not to mention this.   