Created
February 4, 2016 22:24
-
-
Save thiagomg/802fc58c43ee787d3dc0 to your computer and use it in GitHub Desktop.
Leitura de configuração em C++
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
auto after(const Key &prefix) const -> std::unordered_set<Key> { | |
std::unordered_set<Key> values; | |
iterate_and_check(prefix, [&values, &prefix](const std::pair<Key,Value> &pair) { | |
values.insert( pair.first.substr( prefix.size() ) ); | |
}); | |
return values; | |
} | |
auto next_token(const Key &prefix, const typename Key::value_type separator) const -> std::unordered_set<Key> { | |
std::unordered_set<Key> values; | |
int pos = last_of(prefix, separator); | |
iterate_and_check(prefix, [&values, &prefix, &pos, &separator](const std::pair<Key,Value> &pair) { | |
int npos = next_of(pair.first, pos, separator); | |
values.insert( pair.first.substr( pos, npos ) ); | |
}); | |
return values; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment