Created
June 15, 2021 15:19
-
-
Save BogdanAriton/1e1bd2f5ca15c34f88fb29a725019697 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void push_back(const Data &data) noexcept | |
| { | |
| // if the list is empty we're going to add head | |
| if (isEmpty()) | |
| { | |
| head = std::make_unique<Node>(data, nullptr); | |
| } | |
| else | |
| { | |
| Node *current = head.get(); | |
| while (current->next != nullptr) | |
| { | |
| current = current->next.get(); | |
| } | |
| current->next = std::make_unique<Node>(data, nullptr); | |
| } | |
| size++; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment