| 143 | } |
| 144 | |
| 145 | T remove_at(unsigned pos) { |
| 146 | assert(num > 0); |
| 147 | assert(pos < num); |
| 148 | assert(front != nullptr); |
| 149 | |
| 150 | T current = front; |
| 151 | |
| 152 | for (unsigned int i = 0; i < pos && current; i++) current = current->next; |
| 153 | |
| 154 | assert(current); |
| 155 | |
| 156 | if (current->next) current->next->prev = current->prev; |
| 157 | if (current->prev) current->prev->next = current->next; |
| 158 | if (front == current) front = current->next; |
| 159 | if (back == current) back = current->prev; |
| 160 | |
| 161 | if(!(--num)) front = back = nullptr; |
| 162 | |
| 163 | return current; |
| 164 | } |
| 165 | |
| 166 | void remove(T obj){ |
| 167 | if (obj->next) obj->next->prev = obj->prev; |
nothing calls this directly
no outgoing calls
no test coverage detected