Boost logo

Boost :

Subject: Re: [boost] GSoC 2010: Heaps and Queues
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-04-09 00:44:03


AMDG

Dan Larkin wrote:
> *x = newValue;
> update(x);
>
> Or, perhaps some more complex structure that would drive my point home
> a bit more effectively:
>
> x->field[999] = newValue;
> update(x);
>
> As long as the library is explicit about the fact that updating data
> will temporarily void the heap property until an update() call is made
> on the data in question, it should work much better this way.

This is dubious W.R.T. exception safety, because if anything between
the change of the value and the call to update throws or if update itself
throws, the invariants of the heap will be broken.

In Christ,
Steven Watanabe


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