15 #ifndef PAAL_PARSE_FILE_HPP
16 #define PAAL_PARSE_FILE_HPP
33 template <
typename Functor>
void parse(std::istream &input_stream, Functor f) {
34 assert(input_stream.good());
35 while (input_stream.good()) {
36 std::string first_token;
37 input_stream >> first_token;
38 if (first_token ==
"") {
41 if (first_token[0] ==
'#') {
42 input_stream.ignore(std::numeric_limits<std::streamsize>::max(),
46 f(first_token, input_stream);
56 template <
typename Functor>
void parse(
const std::string &filename, Functor f) {
57 std::ifstream input_stream(filename);
58 parse(input_stream, f);
62 #endif // PAAL_PARSE_FILE_HPP
void parse(std::istream &input_stream, Functor f)
parses stream ignoring empty lines or beginning with '#'