Created
April 17, 2021 14:08
-
-
Save hnrck/f983e9c349f01f241b4f0f499147d119 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using token_t = std::string; | |
using tokens_t = std::vector<std::string>; | |
static inline auto tokenize(const std::string &line, char delimiter) -> tokens_t { | |
auto tokens = tokens_t{}; | |
auto ss = std::stringstream{line}; | |
auto token = token_t{}; | |
while (std::getline(ss, token, delimiter)) { | |
if (!token.empty()) { | |
tokens.push_back(token); | |
} | |
} | |
return tokens; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment