From ed63ec4c186d1eb6fc13987d261012a437f27dc0 Mon Sep 17 00:00:00 2001 From: Tim Gilevich Date: Thu, 12 Sep 2024 23:17:16 +0300 Subject: [PATCH] WIP --- HW3/cc_lib/include/cc/forward_list.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/HW3/cc_lib/include/cc/forward_list.h b/HW3/cc_lib/include/cc/forward_list.h index bf7c335..664f55f 100644 --- a/HW3/cc_lib/include/cc/forward_list.h +++ b/HW3/cc_lib/include/cc/forward_list.h @@ -71,11 +71,11 @@ class ForwardList ForwardList(); allocator_type get_allocator() const noexcept; - iterator before_begin() const; + iterator before_begin(); const_iterator cbefore_begin() const; - iterator begin() const; + iterator begin(); const_iterator cbegin() const; - iterator end() const; + iterator end(); const_iterator cend() const; iterator insert_after(iterator position, const value_type& value); bool empty() const noexcept; @@ -146,9 +146,9 @@ auto ForwardList::insert_after(iterator position, const value_type } template -auto ForwardList::before_begin() const -> iterator +auto ForwardList::before_begin() -> iterator { - return { this, const_cast(&head) }; + return { this, &head }; } template @@ -158,7 +158,7 @@ auto ForwardList::cbefore_begin() const -> const_iterator } template -auto ForwardList::begin() const -> iterator +auto ForwardList::begin() -> iterator { return std::next(before_begin()); } @@ -166,11 +166,11 @@ auto ForwardList::begin() const -> iterator template auto ForwardList::cbegin() const -> const_iterator { - return this->begin(); + return begin(); } template -auto ForwardList::end() const -> iterator +auto ForwardList::end() -> iterator { return { this }; } @@ -178,7 +178,7 @@ auto ForwardList::end() const -> iterator template auto ForwardList::cend() const -> const_iterator { - return this->end(); + return end(); } template