Boost logo

Boost :

Subject: Re: [boost] [unordered] unordered_set::erase() complexity bug?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-11-29 22:00:45


On Sun, Nov 29, 2009 at 8:48 AM, John Zwinck <jzwinck_at_[hidden]> wrote:
> OvermindDL1 wrote:
>>
>> Instead of making a new function name, why not a function overload:
>>
>> iterator erase(iterator it); // original
>> void erase(iterator it, no_return); // no_return is an empty global
>> created struct so you can just call m.erase(it, no_return);
>
> Is "m.erase(it, no_return)" better than "m.erase_no_return(it)"?
>
> Is there a precedent (in C++, not Boost) for this, other than the
> (IMO confusing) pre- vs. post-increment operator declarations?
>
> I'm also concerned that people who bind C++ with dynamic languages
> may end up writing wrappers to make it a unary function again.  This
> is a special case of the fact that a binary function may be a little
> more difficult to integrate into code which uses pointers to member
> functions.
>
> I'm open to other opinions, but offhand I prefer a unary function.

As another post showed there is precedent. I find the no_return
cleaner to read personally, and I would not be abject to having it as
a template parameter either as a policy (m.erase<no_return>(it))
either, just seems and reads cleaner to me.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk