The recently-approved Standard Library Hardening proposal (P3471R4)
gives pop_front and pop_back member functions hardened preconditions,
but std::list was missing assertions on them. Our other sequence
containers do have assertions on those members.
libstdc++-v3/ChangeLog:
* include/bits/stl_list.h (list::pop_front, list::pop_back):
Add non-empty assertions.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
*/
void
pop_front() _GLIBCXX_NOEXCEPT
- { this->_M_erase(begin()); }
+ {
+ __glibcxx_requires_nonempty();
+ this->_M_erase(begin());
+ }
/**
* @brief Add data to the end of the %list.
*/
void
pop_back() _GLIBCXX_NOEXCEPT
- { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
+ {
+ __glibcxx_requires_nonempty();
+ this->_M_erase(iterator(this->_M_impl._M_node._M_prev));
+ }
#if __cplusplus >= 201103L
/**