-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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)
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)); | ||
} | ||
} | ||
|