Created
September 14, 2015 16:30
-
-
Save nabijaczleweli/e926a7cdf2ad85e34d70 to your computer and use it in GitHub Desktop.
static-const-nontrivial-init
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
void strip_line(string & line) { | |
static const vector<regex> regices = [&]() { | |
vector<regex> temp(3); | |
for(const auto reg : {"#.*", " +$", "^ +"}) // comment, start-of-line space, end-of-line space | |
temp.emplace_back(reg, regex_constants::optimize); | |
return temp; | |
}(); // <-- any better way of doing this? | |
for(const auto & rgx : regices) | |
line = regex_replace(line, rgx, ""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment