Website Summary Files Commits Branches @commit @diff @stats
path: root / Seminar04
diff options
context:
space:
mode:
Commit450101630aeebfb92da99417a6a71570bdfeb3e6 (patch)
Author
 Stoycho Kyosev <stoycho.kk@gmail.com>
2024-11-12 16:22:34 -0500
Committer
 Stoycho Kyosev <stoycho.kk@gmail.com>
2024-11-12 16:22:34 -0500
Files2a53c04288dd27d2e4fd639e3f409550d85b362f /Seminar04
Data-structures-and-algorithms-450101630aeebfb92da99417a6a71570bdfeb3e6.tar
Data-structures-and-algorithms-450101630aeebfb92da99417a6a71570bdfeb3e6.tar.gz
Data-structures-and-algorithms-450101630aeebfb92da99417a6a71570bdfeb3e6.zip
Parentd866bd4b9fb6d586d0fbe44af9ece7d105b75a0c (diff)
Parent7ecb0c4f2407bbfe8a1300c576f0d2e4b7ef463f (diff)
Merge branch 'main' of https://github.com/stoychoX/Data-structures-and-algorithms
1 files changed, 4 insertions, 5 deletions
-rw-r--r--Seminar04/src/doubly-linked-list.hpp9
diff --git a/Seminar04/src/doubly-linked-list.hpp b/Seminar04/src/doubly-linked-list.hpp
index 3f0435c..c064345 100644
--- a/Seminar04/src/doubly-linked-list.hpp
+++ b/Seminar04/src/doubly-linked-list.hpp
@@ -227,7 +227,7 @@ class doubly_linked_list
const_iterator begin() const
{
- return conmnst_iterator(*this, _head);
+ return const_iterator(*this, _head);
}
const_iterator end() const
{
@@ -317,8 +317,7 @@ void doubly_linked_list<T>::push_front(const T& data)
template <class T>
typename doubly_linked_list<T>::iterator doubly_linked_list<T>::insert(const_iterator position, const T& data)
{
- node* new_node = new node(data);
-
+
if (position == begin())
{
push_front(data);
@@ -329,7 +328,7 @@ typename doubly_linked_list<T>::iterator doubly_linked_list<T>::insert(const_ite
push_back(data);
return --end();
}
-
+ node* new_node = new node(data);
node* current_node = position._node;
new_node->next = current_node;
new_node->prev = current_node->prev;
@@ -455,4 +454,4 @@ template<class T>
doubly_linked_list<T>::~doubly_linked_list()
{
free();
-} \ No newline at end of file
+}