2018-10-11 François Dumont <fdumont@gcc.gnu.org>
+ * include/debug/forward_list
+ (forward_list<>::before_begin()): Use C++11 direct initialization.
+ (forward_list<>::begin()): Likewise.
+ (forward_list<>::end()): Likewise.
+ (forward_list<>::cbefore_begin()): Likewise.
+ (forward_list<>::cbegin()): Likewise.
+ (forward_list<>::cend()): Likewise.
+ (forward_list<>::emplace_after<>(const_iterator, _Args&&...)): Likewise.
+ (forward_list<>::insert_after(const_iterator, const _Tp&)): Likewise.
+ (forward_list<>::insert_after(const_iterator, _Tp&&)): Likewise.
+ (forward_list<>::insert_after(const_iterator, size_type, const _Tp&)):
+ Likewise.
+ (forward_list<>::insert_after(const_iterator, initializer_list<>)):
+ Likewise.
+ (forward_list<>::erase_after(const_iterator)): Likewise.
+ (forward_list<>::erase_after(const_iterator, const_iterator)): Likewise
+ and ensure consistent iterator comparison.
+
* include/bits/forward_list.h
(_Fwd_list_iterator<>::operator==): Replace member function with inline
friend.
iterator
before_begin() noexcept
- { return iterator(_Base::before_begin(), this); }
+ { return { _Base::before_begin(), this }; }
const_iterator
before_begin() const noexcept
- { return const_iterator(_Base::before_begin(), this); }
+ { return { _Base::before_begin(), this }; }
iterator
begin() noexcept
- { return iterator(_Base::begin(), this); }
+ { return { _Base::begin(), this }; }
const_iterator
begin() const noexcept
- { return const_iterator(_Base::begin(), this); }
+ { return { _Base::begin(), this }; }
iterator
end() noexcept
- { return iterator(_Base::end(), this); }
+ { return { _Base::end(), this }; }
const_iterator
end() const noexcept
- { return const_iterator(_Base::end(), this); }
+ { return { _Base::end(), this }; }
const_iterator
cbegin() const noexcept
- { return const_iterator(_Base::cbegin(), this); }
+ { return { _Base::cbegin(), this }; }
const_iterator
cbefore_begin() const noexcept
- { return const_iterator(_Base::cbefore_begin(), this); }
+ { return { _Base::cbefore_begin(), this }; }
const_iterator
cend() const noexcept
- { return const_iterator(_Base::cend(), this); }
+ { return { _Base::cend(), this }; }
using _Base::empty;
using _Base::max_size;
emplace_after(const_iterator __pos, _Args&&... __args)
{
__glibcxx_check_insert_after(__pos);
- return iterator(_Base::emplace_after(__pos.base(),
+ return { _Base::emplace_after(__pos.base(),
std::forward<_Args>(__args)...),
- this);
+ this };
}
iterator
insert_after(const_iterator __pos, const _Tp& __val)
{
__glibcxx_check_insert_after(__pos);
- return iterator(_Base::insert_after(__pos.base(), __val), this);
+ return { _Base::insert_after(__pos.base(), __val), this };
}
iterator
insert_after(const_iterator __pos, _Tp&& __val)
{
__glibcxx_check_insert_after(__pos);
- return iterator(_Base::insert_after(__pos.base(), std::move(__val)),
- this);
+ return { _Base::insert_after(__pos.base(), std::move(__val)), this };
}
iterator
insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
{
__glibcxx_check_insert_after(__pos);
- return iterator(_Base::insert_after(__pos.base(), __n, __val),
- this);
+ return { _Base::insert_after(__pos.base(), __n, __val), this };
}
template<typename _InputIterator,
insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
{
__glibcxx_check_insert_after(__pos);
- return iterator(_Base::insert_after(__pos.base(), __il), this);
+ return { _Base::insert_after(__pos.base(), __il), this };
}
private:
erase_after(const_iterator __pos)
{
__glibcxx_check_erase_after(__pos);
- return iterator(_M_erase_after(__pos.base()), this);
+ return { _M_erase_after(__pos.base()), this };
}
iterator
for (_Base_const_iterator __victim = std::next(__pos.base());
__victim != __last.base(); ++__victim)
{
- _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
+ _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
_M_message(__gnu_debug::__msg_valid_range2)
._M_sequence(*this, "this")
._M_iterator(__pos, "pos")
this->_M_invalidate_if([__victim](_Base_const_iterator __it)
{ return __it == __victim; });
}
- return iterator(_Base::erase_after(__pos.base(), __last.base()), this);
+
+ return { _Base::erase_after(__pos.base(), __last.base()), this };
}
void