From 75999aa9ad6d5ee65b799b8eb6d98be866211dfa Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Tue, 21 Jul 2020 20:52:39 +0900 Subject: [PATCH] refactor: add a constructor to location By adding the constructor, vec() would not be not needed. But inserting Container = std::string makes the constructor ambiguous, so it breaks the current code. --- toml/region.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toml/region.hpp b/toml/region.hpp index ee33c93..dd8086c 100644 --- a/toml/region.hpp +++ b/toml/region.hpp @@ -85,6 +85,12 @@ struct location final : public region_base : source_(std::make_shared(std::move(cont))), line_number_(1), source_name_(std::move(name)), iter_(source_->cbegin()) {} + + location(std::string name, const std::string& cont) + : source_(std::make_shared(cont.begin(), cont.end())), + line_number_(1), source_name_(std::move(name)), iter_(source_->cbegin()) + {} + location(const location&) = default; location(location&&) = default; location& operator=(const location&) = default;