Created
February 15, 2013 14:23
-
-
Save klmr/4960666 to your computer and use it in GitHub Desktop.
Read-group extraction without temporary buffer
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
while (getline(in, line)) { | |
if (line.compare(0, 4, "@RG\t") != 0) continue; | |
size_t start = line.find("\tID:"); | |
if (start == string::npos) continue; | |
start += 4; | |
size_t end = line.find("\t", start); | |
if (end == string::npos or end == start) continue; | |
gids.emplace(string.begin() + start, string.begin() + end); | |
// Or, in C++03: | |
//gids.insert(line.substr(start, end - start)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment