@@ -1693,7 +1693,7 @@ class OR_DLL Model {
16931693 // / is a neighborhood arc for 'cost_class'.
16941694 const std::vector<int >& GetIncomingNeighborsOfNodeForCostClass (
16951695 int cost_class, int node_index) const {
1696- if (routing_model_.IsStart (node_index)) return empty_neighbors_ ;
1696+ if (routing_model_.IsStart (node_index)) return GetEmptyNeighbors () ;
16971697
16981698 if (node_index_to_incoming_neighbors_by_cost_class_.empty ()) {
16991699 DCHECK (IsFullNeighborhood ());
@@ -1702,7 +1702,7 @@ class OR_DLL Model {
17021702 const std::vector<std::vector<int >>& node_index_to_incoming_neighbors =
17031703 node_index_to_incoming_neighbors_by_cost_class_[cost_class];
17041704 if (node_index_to_incoming_neighbors.empty ()) {
1705- return empty_neighbors_ ;
1705+ return GetEmptyNeighbors () ;
17061706 }
17071707 return node_index_to_incoming_neighbors[node_index];
17081708 }
@@ -1712,7 +1712,7 @@ class OR_DLL Model {
17121712 // / arc for 'cost_class'.
17131713 const std::vector<int >& GetOutgoingNeighborsOfNodeForCostClass (
17141714 int cost_class, int node_index) const {
1715- if (routing_model_.IsEnd (node_index)) return empty_neighbors_ ;
1715+ if (routing_model_.IsEnd (node_index)) return GetEmptyNeighbors () ;
17161716
17171717 if (node_index_to_outgoing_neighbors_by_cost_class_.empty ()) {
17181718 DCHECK (IsFullNeighborhood ());
@@ -1721,7 +1721,7 @@ class OR_DLL Model {
17211721 const std::vector<std::vector<int >>& node_index_to_outgoing_neighbors =
17221722 node_index_to_outgoing_neighbors_by_cost_class_[cost_class];
17231723 if (node_index_to_outgoing_neighbors.empty ()) {
1724- return empty_neighbors_ ;
1724+ return GetEmptyNeighbors () ;
17251725 }
17261726 return node_index_to_outgoing_neighbors[node_index];
17271727 }
@@ -1744,12 +1744,9 @@ class OR_DLL Model {
17441744 bool IsFullNeighborhood () const { return full_neighborhood_; }
17451745
17461746 private:
1747+ static const std::vector<int >& GetEmptyNeighbors ();
1748+
17471749 const Model& routing_model_;
1748- #if __cplusplus >= 202002L && !defined(__APPLE__)
1749- static constexpr std::vector<int > empty_neighbors_ = {};
1750- #else
1751- inline static const std::vector<int > empty_neighbors_ = {};
1752- #endif
17531750
17541751 std::vector<std::vector<std::vector<int >>>
17551752 node_index_to_incoming_neighbors_by_cost_class_;
0 commit comments