Skip to content

Instantly share code, notes, and snippets.

Created Jul 7, 2016
What would you like to do?
code for SO question
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <fstream>
#include <sstream>
using namespace std;
vector<string> inline tokenize(string str) {
/* tested faster than other methods */
istringstream iss(str);
return {istream_iterator<string>{iss}, istream_iterator<string>{}};
int main() {
ifstream inputfile("file.txt");
string input;
getline(inputfile, input);
vector<string> tokens = tokenize(input);
string a = tokens[0];
string b = tokens[1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment