#pragma once struct config_entry { const char * key; void * variable; bool (*parse)(const char *, void *); }; static inline void ?{}( config_entry & this ) {} forall(T & | { bool parse(const char *, T & ); }) static inline void ?{}( config_entry & this, const char * key, T & variable ) { this.key = key; this.variable = (void *)&variable; this.parse = (bool (*)(const char *, void *))parse; } forall(T &) static inline void ?{}( config_entry & this, const char * key, T & variable, bool (*parse)(const char *, T &) ) { this.key = key; this.variable = (void *)&variable; this.parse = (bool (*)(const char *, void *))parse; } void parse_config( const char * config_file, config_entry entries[], size_t num_entries ); bool parse( const char *, const char * & ); bool parse( const char *, int & ); bool parse( const char *, unsigned & ); bool parse( const char *, unsigned long & ); bool parse( const char *, unsigned long long & ); bool parse( const char *, float & ); bool parse( const char *, double & ); // Local Variables: // // mode: c // // tab-width: 4 // // End: //