Boost logo

Boost Users :

Subject: Re: [Boost-users] [intrusive] insert_check and insert_commit
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-02-07 20:36:41


AMDG

On 2/7/2011 3:26 PM, Paul Rose wrote:
> I have a question regarding insert_check and insert_commit on an intrusive
> set.
>
> I know that you must call insert_commit after calling insert_check, with no
> modifications to the set between the two calls.
>
> Is it OK, however, to call insert_check and then never call insert_commit
> (even though insert_check was successful)?
>
> Say I have objects contained in multiple sets (using multiple hooks). I
> want to insert a new object into each of the sets, but only if I know that
> the insert will succeed on all of the sets. I call insert_check on each,
> and if all succeed I call insert_commit on each. If any of the insert_check
> calls fail, I do none of the insert_commits (even though all but one might
> have worked)
>
> It seems like it should be OK, and the documentation doesn't say that it
> won't work. I'm only concerned for two related reasons:
>
> 1) insert_check is not declared const. Does this mean that the set is
> already partially modified?
>

No.

> 2) insert_commit is documented as constant time. Does this mean that any
> red-black rebalancing was already done during insert_check? If so, what
> happens if I never do the insert_commit?
>

rebalancing happens in insert_commit. The complexity
is wrong.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net