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.
This commit is contained in:
ToruNiina
2020-07-21 20:52:39 +09:00
parent 259da54edb
commit 75999aa9ad

View File

@@ -85,6 +85,12 @@ struct location final : public region_base
: source_(std::make_shared<Container>(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<Container>(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;