[vcpkg_Parse] Add missing const

This commit is contained in:
Alexander Karatarakis 2017-09-01 17:01:02 -07:00
parent 95eadb8ddd
commit c15c80e802
2 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ namespace vcpkg::Parse
ParagraphParser(RawParagraph&& fields) : fields(std::move(fields)) {}
void required_field(const std::string& fieldname, std::string& out);
std::string optional_field(const std::string& fieldname);
std::string optional_field(const std::string& fieldname) const;
std::unique_ptr<ParseControlErrorInfo> error_info(const std::string& name) const;
private:

View File

@ -23,12 +23,12 @@ namespace vcpkg::Parse
void ParagraphParser::required_field(const std::string& fieldname, std::string& out)
{
auto maybe_field = remove_field(&fields, fieldname);
if (auto field = maybe_field.get())
if (const auto field = maybe_field.get())
out = std::move(*field);
else
missing_fields.push_back(fieldname);
}
std::string ParagraphParser::optional_field(const std::string& fieldname)
std::string ParagraphParser::optional_field(const std::string& fieldname) const
{
return remove_field(&fields, fieldname).value_or(Strings::EMPTY);
}