diff --git a/include/etl/intrusive_forward_list.h b/include/etl/intrusive_forward_list.h index da74970b..e3ae13c8 100644 --- a/include/etl/intrusive_forward_list.h +++ b/include/etl/intrusive_forward_list.h @@ -332,11 +332,6 @@ namespace etl { } - iterator(value_type* value) - : p_value(value) - { - } - iterator(const iterator& other) : p_value(other.p_value) { @@ -390,6 +385,11 @@ namespace etl private: + iterator(value_type* value) + : p_value(value) + { + } + value_type* p_value; }; @@ -407,11 +407,6 @@ namespace etl { } - const_iterator(const value_type* value) - : p_value(value) - { - } - const_iterator(const typename intrusive_forward_list::iterator& other) : p_value(other.p_value) { @@ -470,6 +465,11 @@ namespace etl private: + const_iterator(const value_type* value) + : p_value(value) + { + } + const value_type* p_value; }; @@ -521,7 +521,7 @@ namespace etl //************************************************************************* iterator before_begin() { - return iterator(&(static_cast(this->start_link))); + return iterator(static_cast(&this->start_link)); } //************************************************************************* @@ -529,7 +529,7 @@ namespace etl //************************************************************************* const_iterator before_begin() const { - return const_iterator(&(static_cast(this->start_link))); + return const_iterator(static_cast(&this->start_link)); } //************************************************************************* @@ -569,7 +569,7 @@ namespace etl //************************************************************************* reference front() { - return static_cast(*(this->get_head())); + return *static_cast(this->get_head()); } //************************************************************************* @@ -577,7 +577,7 @@ namespace etl //************************************************************************* const_reference front() const { - return static_cast(*(this->get_head())); + return *static_cast(this->get_head()); } //************************************************************************* diff --git a/include/etl/intrusive_list.h b/include/etl/intrusive_list.h index 800c9d8e..d8b2b9ad 100644 --- a/include/etl/intrusive_list.h +++ b/include/etl/intrusive_list.h @@ -387,11 +387,6 @@ namespace etl { } - iterator(value_type& value) - : p_value(&value) - { - } - iterator(const iterator& other) : p_value(other.p_value) { @@ -460,6 +455,11 @@ namespace etl private: + iterator(value_type* value) + : p_value(value) + { + } + value_type* p_value; }; @@ -477,11 +477,6 @@ namespace etl { } - const_iterator(const value_type& value) - : p_value(&value) - { - } - const_iterator(const typename intrusive_list::iterator& other) : p_value(other.p_value) { @@ -555,6 +550,11 @@ namespace etl private: + const_iterator(const value_type* value) + : p_value(value) + { + } + const value_type* p_value; }; @@ -590,7 +590,7 @@ namespace etl //************************************************************************* iterator begin() { - return iterator(static_cast(*this->get_head())); + return iterator(static_cast(this->get_head())); } //************************************************************************* @@ -598,7 +598,7 @@ namespace etl //************************************************************************* const_iterator begin() const { - return const_iterator(static_cast(*this->get_head())); + return const_iterator(static_cast(this->get_head())); } //************************************************************************* @@ -606,7 +606,7 @@ namespace etl //************************************************************************* const_iterator cbegin() const { - return const_iterator(static_cast(*this->get_head())); + return const_iterator(static_cast(this->get_head())); } //************************************************************************* @@ -614,7 +614,7 @@ namespace etl //************************************************************************* iterator end() { - return iterator(static_cast(this->terminal_link)); + return iterator(static_cast(&this->terminal_link)); } //************************************************************************* @@ -622,7 +622,7 @@ namespace etl //************************************************************************* const_iterator end() const { - return const_iterator(static_cast(this->terminal_link)); + return const_iterator(static_cast(&this->terminal_link)); } //************************************************************************* @@ -630,7 +630,7 @@ namespace etl //************************************************************************* const_iterator cend() const { - return const_iterator(static_cast(this->terminal_link)); + return const_iterator(static_cast(&this->terminal_link)); } //************************************************************************* @@ -671,7 +671,7 @@ namespace etl iterator insert(const_iterator position, value_type& value) { this->insert_link(position.p_value->link_type::etl_previous, value); - return iterator(value); + return iterator(&value); } //************************************************************************* @@ -737,7 +737,7 @@ namespace etl } else { - return iterator(*static_cast(p_last)); + return iterator(static_cast(p_last)); } }