@@ -81,13 +81,13 @@ namespace Rice::detail {
8181 double is_convertible (VALUE value) { return Convertible::Exact; }
8282
8383 RoutingModel::PenaltyCostBehavior convert (VALUE x) {
84- auto s = Symbol (x).str ();
84+ std::string s = Symbol (x).str ();
8585 if (s == " penalize_once" ) {
8686 return RoutingModel::PenaltyCostBehavior::PENALIZE_ONCE ;
8787 } else if (s == " penalize_per_inactive" ) {
8888 return RoutingModel::PenaltyCostBehavior::PENALIZE_PER_INACTIVE ;
8989 } else {
90- throw std::runtime_error ( " Unknown penalty cost behavior: " + s) ;
90+ throw std::runtime_error{ " Unknown penalty cost behavior: " + s} ;
9191 }
9292 }
9393
@@ -138,7 +138,7 @@ void init_routing(Rice::Module& m) {
138138 } else if (s == " first_unbound_min_value" ) {
139139 v = FirstSolutionStrategy::FIRST_UNBOUND_MIN_VALUE ;
140140 } else {
141- throw std::runtime_error ( " Unknown first solution strategy: " + s) ;
141+ throw std::runtime_error{ " Unknown first solution strategy: " + s} ;
142142 }
143143
144144 return self.set_first_solution_strategy (v);
@@ -158,7 +158,7 @@ void init_routing(Rice::Module& m) {
158158 } else if (s == " simulated_annealing" ) {
159159 v = LocalSearchMetaheuristic::SIMULATED_ANNEALING ;
160160 } else {
161- throw std::runtime_error ( " Unknown local search metaheuristic: " + s) ;
161+ throw std::runtime_error{ " Unknown local search metaheuristic: " + s} ;
162162 }
163163
164164 return self.set_local_search_metaheuristic (v);
@@ -192,7 +192,7 @@ void init_routing(Rice::Module& m) {
192192 })
193193 .define_singleton_function (
194194 " _new_starts_ends" ,
195- [](int num_nodes, int num_vehicles, std::vector<RoutingNodeIndex> starts, std::vector<RoutingNodeIndex> ends) {
195+ [](int num_nodes, int num_vehicles, const std::vector<RoutingNodeIndex>& starts, const std::vector<RoutingNodeIndex>& ends) {
196196 return RoutingIndexManager (num_nodes, num_vehicles, starts, ends);
197197 })
198198 .define_method (" index_to_node" , &RoutingIndexManager::IndexToNode)
@@ -279,7 +279,7 @@ void init_routing(Rice::Module& m) {
279279 } else if (op == " <=" ) {
280280 constraint = self.MakeLessOrEqual (left, right);
281281 } else {
282- throw std::runtime_error ( " Unknown operator" ) ;
282+ throw std::runtime_error{ " Unknown operator" } ;
283283 }
284284 } else {
285285 constraint = Rice::detail::From_Ruby<operations_research::Constraint*>().convert (o);
@@ -293,7 +293,7 @@ void init_routing(Rice::Module& m) {
293293 })
294294 .define_method (
295295 " cumulative" ,
296- [](operations_research::Solver& self, Array rb_intervals, std::vector<int64_t > demands, int64_t capacity, const std::string& name) {
296+ [](operations_research::Solver& self, Array rb_intervals, const std::vector<int64_t >& demands, int64_t capacity, const std::string& name) {
297297 std::vector<operations_research::IntervalVar*> intervals;
298298 for (const auto & v : rb_intervals) {
299299 intervals.push_back (Rice::detail::From_Ruby<operations_research::IntervalVar*>().convert (v.value ()));
@@ -338,7 +338,7 @@ void init_routing(Rice::Module& m) {
338338 return self.RegisterUnaryTransitCallback (
339339 [callback](int64_t from_index) -> int64_t {
340340 if (!ruby_native_thread_p ()) {
341- throw std::runtime_error ( " Non-Ruby thread" ) ;
341+ throw std::runtime_error{ " Non-Ruby thread" } ;
342342 }
343343
344344 return Rice::detail::From_Ruby<int64_t >().convert (callback.call (" call" , from_index));
@@ -353,7 +353,7 @@ void init_routing(Rice::Module& m) {
353353 return self.RegisterTransitCallback (
354354 [callback](int64_t from_index, int64_t to_index) -> int64_t {
355355 if (!ruby_native_thread_p ()) {
356- throw std::runtime_error ( " Non-Ruby thread" ) ;
356+ throw std::runtime_error{ " Non-Ruby thread" } ;
357357 }
358358
359359 return Rice::detail::From_Ruby<int64_t >().convert (callback.call (" call" , from_index, to_index));
@@ -451,7 +451,7 @@ void init_routing(Rice::Module& m) {
451451 } else if (status == RoutingSearchStatus::ROUTING_INVALID ) {
452452 return Symbol (" invalid" );
453453 } else {
454- throw std::runtime_error ( " Unknown solver status" ) ;
454+ throw std::runtime_error{ " Unknown solver status" } ;
455455 }
456456 })
457457 .define_method (" apply_locks" , &RoutingModel::ApplyLocks)
0 commit comments