Skip to content

Commit

Permalink
Fixed two bugs in iterator functions of linked list.
Browse files Browse the repository at this point in the history
  • Loading branch information
ax-6 committed Apr 3, 2024
1 parent 8e3b067 commit b89b8e8
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions compiler/linked_list/linked_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,12 @@ void Compiler::LinkedList<DataType>::Remove(Iterator* delete_node) {
template <typename DataType>
typename Compiler::LinkedList<DataType>::Iterator
Compiler::LinkedList<DataType>::Begin() const {
if (head_ == nullptr) {
Debugger error(Debugger::Level::ERROR,
"Aq::Compiler::LinkedList<DataType>::Begin",
"Begin_HeadError", "Head out of range occurred.", nullptr);
return Iterator(nullptr);
}
return Iterator(head_);
}

template <typename DataType>
typename Compiler::LinkedList<DataType>::Iterator
Compiler::LinkedList<DataType>::End() const {
if (head_ == nullptr) {
Debugger error(Debugger::Level::ERROR,
"Aq::Compiler::LinkedList<DataType>::End", "End_TailError",
"Tail out of range occurred.", nullptr);
return Iterator(nullptr);
}
return Iterator(tail_);
}

Expand Down

0 comments on commit b89b8e8

Please sign in to comment.