Skip to content

Instantly share code, notes, and snippets.

@thiagomg
Created February 4, 2016 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagomg/802fc58c43ee787d3dc0 to your computer and use it in GitHub Desktop.
Save thiagomg/802fc58c43ee787d3dc0 to your computer and use it in GitHub Desktop.
Leitura de configuração em C++
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