diff --git a/toml/region.hpp b/toml/region.hpp index c87547a..ee33c93 100644 --- a/toml/region.hpp +++ b/toml/region.hpp @@ -48,6 +48,8 @@ struct region_base virtual std::string line() const {return std::string("unknown line");} virtual std::string line_num() const {return std::string("?");} + virtual std::vector vec() const {return std::vector{};} + // length of the region virtual std::size_t size() const noexcept {return 0;} // number of characters in the line before the region @@ -141,6 +143,8 @@ struct location final : public region_base std::string str() const override {return make_string(1, *this->iter());} std::string name() const override {return source_name_;} + std::vector vec() const override {return std::vector{*this->iter()};} + std::string line_num() const override { return std::to_string(this->line_number_); @@ -259,6 +263,8 @@ struct region final : public region_base return std::to_string(1 + std::count(this->begin(), this->first(), '\n')); } + std::vector vec() const override {return std::vector(first_, last_);} + std::size_t size() const noexcept override { const auto sz = std::distance(first_, last_);