or-tools: fix string_view compilation issue (#258332)
Fixes #256266 Don't use non-existent member function on string_view. (StringPiece and string_view are almost the same looks like they are typedef'd to the same string_view. StringPiece used to have a as_string() member)
This commit is contained in:
parent
d04fa2b5be
commit
ae3ea8c12a
@ -45,6 +45,9 @@ stdenv.mkDerivation rec {
|
||||
url = "https://github.com/google/or-tools/commit/edd1544375bd55f79168db315151a48faa548fa0.patch";
|
||||
hash = "sha256-S//1YM3IoRCp3Ghg8zMF0XXgIpVmaw4gH8cVb9eUbqM=";
|
||||
})
|
||||
# Don't use non-existent member of string_view. Partial patch from commit
|
||||
# https://github.com/google/or-tools/commit/c5a2fa1eb673bf652cb9ad4f5049d054b8166e17.patch
|
||||
./fix-stringview-compile.patch
|
||||
];
|
||||
|
||||
# or-tools normally attempts to build Protobuf for the build platform when
|
||||
|
@ -0,0 +1,36 @@
|
||||
diff --git a/ortools/lp_data/lp_parser.cc b/ortools/lp_data/lp_parser.cc
|
||||
index 58286306e5..bd26c019ab 100644
|
||||
--- a/ortools/lp_data/lp_parser.cc
|
||||
+++ b/ortools/lp_data/lp_parser.cc
|
||||
@@ -185,7 +185,7 @@ bool LPParser::ParseIntegerVariablesList(StringPiece line) {
|
||||
|
||||
bool LPParser::ParseConstraint(StringPiece constraint) {
|
||||
const StatusOr<ParsedConstraint> parsed_constraint_or_status =
|
||||
- ::operations_research::glop::ParseConstraint(constraint.as_string());
|
||||
+ ::operations_research::glop::ParseConstraint(constraint);
|
||||
if (!parsed_constraint_or_status.ok()) return false;
|
||||
const ParsedConstraint& parsed_constraint =
|
||||
parsed_constraint_or_status.value();
|
||||
@@ -342,10 +342,9 @@ TokenType LPParser::ConsumeToken(StringPiece* sp) {
|
||||
|
||||
} // namespace
|
||||
|
||||
-StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint_view) {
|
||||
+StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint) {
|
||||
ParsedConstraint parsed_constraint;
|
||||
// Get the name, if present.
|
||||
- StringPiece constraint{constraint_view};
|
||||
StringPiece constraint_copy{constraint};
|
||||
std::string consumed_name;
|
||||
Fractional consumed_coeff;
|
||||
@@ -413,8 +412,8 @@ StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint_view) {
|
||||
right_bound = consumed_coeff;
|
||||
if (ConsumeToken(&constraint, &consumed_name, &consumed_coeff) !=
|
||||
TokenType::END) {
|
||||
- return absl::InvalidArgumentError(absl::StrCat(
|
||||
- "End of input was expected, found: ", constraint.as_string()));
|
||||
+ return absl::InvalidArgumentError(
|
||||
+ absl::StrCat("End of input was expected, found: ", constraint));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user