[haiku-commits] Re: haiku: hrev52870 - headers/private/shared src/servers/app/font src/servers/media

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 15 Feb 2019 09:49:30 -0500

On Fri, Feb 15, 2019, 7:41 AM Dario Casalinuovo <b.vitruvio@xxxxxxxxx wrote:

Hi,


b7598b65ba6d: HashSet: Make iterator const.

  Nothing that uses this API at present needs a const iterator (and
  as far as I could see, nothing ever called Remove() on the iterator.)
  But this is now how HashMap's API works, so let's be consistent.


Unless I'm missing something, what's the reason for removing Remove()? Is
the problem calling a non-const method to remove the iterator? (now that it
is const, of course) If I got it right, that doesn't seem a design choice,
but looks like lazy programming honestly.


Remove doesn't remove the iterator, it removes the present item the
iterator is on. There isn't a lot of need for such a method as such, we can
just add an overload in the HashSet itself to do the same thing with the
iterator as an argument. Then we don't need both a const and a non const
iterator.

-waddlesplash


Other related posts: