Skip to content

Instantly share code, notes, and snippets.

@thiagomg thiagomg/config.h

Created Feb 4, 2016
What would you like to do?
Leitura de configuração em C++
template<typename Key, typename Value, typename AdderFunc>
void crack(config_holder<Key, Value> &config, const std::string &line, char delim, AdderFunc f) {
auto b = std::begin(line);
auto e = std::end(line);
auto pos = line.find(delim);
if( pos != std::string::npos ) {
f(config, b, b+pos, e);
//nossa AdderFunc
void default_adder(
config_holder<std::string, std::string> &config,
iter_type b, iter_type m, iter_type e) {
//b-m => key / m+1-e => value
config.add_item( b, m, m+1, e );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.