#include <string>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
int main() {
string sentence = "All of this has happened before...";
vector<string> tokens;
istringstream iss(sentence);
copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter<vector<string> >(tokens));
}
cpp
1
#include <string>#include <sstream>#include <algorithm>#include <iterator>#include <vector>usingnamespacestd;intmain(){stringsentence="All of this has happened before...";vector<string>tokens;istringstreamiss(sentence);copy(istream_iterator<string>(iss),istream_iterator<string>(),back_inserter<vector<string>>(tokens));}
Hey there! I see you're running Internet Explorer 6.
That's neat. This reminds me of my grandpa. He had this old car that he kept having to fix. He spent so much money on it that he didn't want to get rid of it (even when it stopped running).
0 Comments