| 37 | } |
| 38 | |
| 39 | bool LinkedObjectList::remove(LinkedObject* object) |
| 40 | { |
| 41 | if(object == nullptr || mHead == nullptr) { |
| 42 | return false; |
| 43 | } |
| 44 | |
| 45 | if(mHead == object) { |
| 46 | mHead = object->mNext; |
| 47 | return true; |
| 48 | } |
| 49 | |
| 50 | auto it = mHead; |
| 51 | while(it->mNext != nullptr) { |
| 52 | if(it->mNext == object) { |
| 53 | it->mNext = object->mNext; |
| 54 | object->mNext = nullptr; |
| 55 | return true; |
| 56 | } |
| 57 | it = it->mNext; |
| 58 | } |
| 59 | |
| 60 | return false; |
| 61 | } |
no outgoing calls
no test coverage detected