A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue132 below:

resize description uses random access iterators

This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of TC1 status.

132. list::resize description uses random access iterators

Section: 23.3.11.3 [list.capacity] Status: TC1 Submitter: Howard Hinnant Opened: 1999-03-06 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [list.capacity].

View all issues with TC1 status.

Discussion:

The description reads:

-1- Effects:

         if (sz > size())
           insert(end(), sz-size(), c);
         else if (sz < size())
           erase(begin()+sz, end());
         else
           ;                           //  do nothing

Obviously list::resize should not be specified in terms of random access iterators.

Proposed resolution:

Change 23.3.11.3 [list.capacity] paragraph 1 to:

Effects:

         if (sz > size())
           insert(end(), sz-size(), c);
         else if (sz < size())
         {
           iterator i = begin();
           advance(i, sz);
           erase(i, end());
         }

[Dublin: The LWG asked Howard to discuss exception safety offline with David Abrahams. They had a discussion and believe there is no issue of exception safety with the proposed resolution.]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4