14#ifndef OR_TOOLS_ALGORITHMS_DENSE_DOUBLY_LINKED_LIST_H_
15#define OR_TOOLS_ALGORITHMS_DENSE_DOUBLY_LINKED_LIST_H_
37 int Size()
const {
return next_.size(); }
41 int Next(
int i)
const;
42 int Prev(
int i)
const;
48 std::vector<int> next_;
49 std::vector<int> prev_;
69 const int prev =
Prev(i);
71 if (prev >= 0) next_[prev] =
next;
78 : next_(elements.size(), -2), prev_(elements.size(), -2) {
80 for (
const int e : elements) {
83 DCHECK_EQ(-2, prev_[e]) <<
"Duplicate element: " << e;
85 if (last >= 0) next_[last] = e;
88 if (!elements.empty()) next_[elements.back()] = -1;
#define DCHECK_LE(val1, val2)
#define DCHECK_NE(val1, val2)
#define DCHECK_GE(val1, val2)
#define DCHECK_LT(val1, val2)
#define DCHECK_EQ(val1, val2)
DenseDoublyLinkedList(const T &sorted_elements)
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...