> -Original Message-
> From: Jonathan Wakely
> Sent: Thursday, March 20, 2025 18:01
> To: James K. Lowden
> Cc: gcc-patches@gcc.gnu.org; Robert Dubner
> Subject: Re: [PATCH] cobol: Replace quadratic loop removing std::set
> elements
>
> On Thu, 20 Mar 202
There's no need to keep using std::find_if from the beginning of the
container after every removal, just update the iterator after erasing an
element.
This is how C++20 std::erase_if is implemented.
gcc/cobol/ChangeLog:
* except.cc (cbl_enabled_exceptions_t::turn_on_off): Replace
On Thu, 20 Mar 2025 22:01:28 +
Jonathan Wakely wrote:
> > LGTM. I am gun-shy about using iterators while modifying
> > containers. I know there are rules. :-/
>
> Yes, the erased iterator is invalidated, but it returns an iterator to
> the next element after the erased one, so we can conti
On Wed, 19 Mar 2025 20:33:36 +
Jonathan Wakely wrote:
> There's no need to keep using std::find_if from the beginning of the
> container after every removal, just update the iterator after erasing
> an element.
>
> This is how C++20 std::erase_if is implemented.\
LGTM. I am gun-shy about u
On Thu, 20 Mar 2025 at 21:27, James K. Lowden wrote:
>
> On Wed, 19 Mar 2025 20:33:36 +
> Jonathan Wakely wrote:
>
> > There's no need to keep using std::find_if from the beginning of the
> > container after every removal, just update the iterator after erasing
> > an element.
> >
> > This is