[vcpkg_Parse] Add missing const
MODIFY
include/vcpkg_Parse.h
include/vcpkg_Parse.h
@@ -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:

MODIFY
src/vcpkg_Parse.cpp
src/vcpkg_Parse.cpp
@@ -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);
}

[vcpkg_Parse] Add missing const