From 6862264bde14642e557ecc81f83e34a90ffe037e Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 1 Nov 2019 20:47:25 +0900 Subject: [PATCH] feat: use the first char as the top-level region A bit related to #89 --- toml/parser.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toml/parser.hpp b/toml/parser.hpp index a1c0150..ec7ffb6 100644 --- a/toml/parser.hpp +++ b/toml/parser.hpp @@ -1836,12 +1836,12 @@ result parse_toml_file(location& loc) const auto first = loc.iter(); if(first == loc.end()) { - return ok(value_type(table_type{})); + return ok(value_type(table_type{}, /* empty file has no region ...*/)); } // put the first line as a region of a file - const region file(loc, loc.iter(), - std::find(loc.iter(), loc.end(), '\n')); + // Here first != loc.end(), so taking std::next is okay + const region file(loc, first, std::next(loc.iter())); // The first successive comments that are separated from the first value // by an empty line are for a file itself.