Files
nixpkgs/pkgs/development/libraries/science/math/or-tools/fix-stringview-compile.patch
T
Henner Zeller ae3ea8c12a 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)
2023-10-01 12:31:24 +02:00

37 lines
1.6 KiB
Diff

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));
}
}