From 5c343d596aa5cc7d41db53a01c9122fae86c174a Mon Sep 17 00:00:00 2001 From: Gleb Belov Date: Thu, 29 Feb 2024 21:15:05 +1100 Subject: [PATCH] Constraint export: short type names #232 --- include/mp/flat/constr_keeper.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/mp/flat/constr_keeper.h b/include/mp/flat/constr_keeper.h index 09270f12e..8360204f8 100644 --- a/include/mp/flat/constr_keeper.h +++ b/include/mp/flat/constr_keeper.h @@ -540,6 +540,7 @@ const char* BasicConstraintKeeper::GetShortTypeName() const { if (type_name_short_.empty()) { std::string acc_opt = GetAcceptanceOptionNames(); + assert(acc_opt.size()); auto word_end = std::min(acc_opt.find(' '), acc_opt.size()); auto colon_pos = acc_opt.find(':'); @@ -547,6 +548,7 @@ BasicConstraintKeeper::GetShortTypeName() const { colon_pos = 0; type_name_short_ = acc_opt.substr( colon_pos, word_end-colon_pos); + assert(type_name_short_.size()); } return type_name_short_.c_str(); } @@ -878,7 +880,7 @@ class ConstraintKeeper final fmt::MemoryWriter wrt; { MiniJSONWriter jw(wrt); - jw["con_type"] = cnt.con_.GetTypeName(); + jw["con_type"] = GetShortTypeName(); jw["index"] = i_con; jw["depth"] = cnt.GetDepth(); // wrt.write("\"data\": ");