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;
90 for (
int p : prev_) DCHECK_NE(-2, p);
91 for (
int n : next_) DCHECK_NE(-2, n);