2121#include " absl/strings/numbers.h"
2222#include " absl/strings/str_split.h"
2323#include " absl/strings/string_view.h"
24+ #include " absl/types/span.h"
2425#include " ortools/base/helpers.h"
2526#include " ortools/base/map_util.h"
2627
@@ -94,7 +95,7 @@ void DomainParser::Parse() {
9495 }
9596
9697 if (!domain.empty ()) {
97- gtl::InsertOrUpdate (& domains_, key, domain);
98+ domains_. insert_or_assign ( key, domain);
9899 }
99100 }
100101}
@@ -198,7 +199,7 @@ void ParametersParser::Parse() {
198199}
199200
200201// TODO(user): Make FindComponents linear instead of quadratic.
201- void FindComponents (const std::vector< FapConstraint>& constraints,
202+ void FindComponents (absl::Span< const FapConstraint> constraints,
202203 const absl::btree_map<int , FapVariable>& variables,
203204 const int maximum_variable_id,
204205 absl::flat_hash_map<int , FapComponent>* components) {
@@ -216,20 +217,20 @@ void FindComponents(const std::vector<FapConstraint>& constraints,
216217 // Create a new one.
217218 FapComponent component;
218219 const int component_index = constraint_index;
219- gtl::InsertOrUpdate (&( component.variables ), variable_id1, variable1);
220- gtl::InsertOrUpdate (&( component.variables ), variable_id2, variable2);
220+ ( component.variables ). insert_or_assign ( variable_id1, variable1);
221+ ( component.variables ). insert_or_assign ( variable_id2, variable2);
221222 in_component[variable_id1] = component_index;
222223 in_component[variable_id2] = component_index;
223224 component.constraints .push_back (constraint);
224- gtl::InsertOrUpdate ( components, component_index, component);
225+ components-> insert_or_assign ( component_index, component);
225226 } else if (in_component[variable_id1] >= 0 &&
226227 in_component[variable_id2] < 0 ) {
227228 // If variable1 belongs to an existing component, variable2 should
228229 // also be included in the same component.
229230 const int component_index = in_component[variable_id1];
230231 CHECK (components->contains (component_index));
231- gtl::InsertOrUpdate (&(( *components)[component_index].variables ),
232- variable_id2, variable2);
232+ (( *components)[component_index].variables )
233+ . insert_or_assign ( variable_id2, variable2);
233234 in_component[variable_id2] = component_index;
234235 (*components)[component_index].constraints .push_back (constraint);
235236 } else if (in_component[variable_id1] < 0 &&
@@ -238,8 +239,8 @@ void FindComponents(const std::vector<FapConstraint>& constraints,
238239 // also be included in the same component.
239240 const int component_index = in_component[variable_id2];
240241 CHECK (components->contains (component_index));
241- gtl::InsertOrUpdate (&(( *components)[component_index].variables ),
242- variable_id1, variable1);
242+ (( *components)[component_index].variables )
243+ . insert_or_assign ( variable_id1, variable1);
243244 in_component[variable_id1] = component_index;
244245 (*components)[component_index].constraints .push_back (constraint);
245246 } else {
0 commit comments