Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-04-09 11:37:19


Raymond Haeb wrote:
> Hello,
> [snip]

> So the question is in the comment: Is there a way to change the value of
> an element of a set or insert an (new) element in a set, without having
> a pointer to the set?

No, sorry. To insert a value in a set you need access to the predicate,
which is stored in the set. In case the predicate is stateless and the
constant_time_size is false (as your example shows) I think it's
possible to implement an static function that removes the node, climbs
up to the root node of the tree and inserts the new node. Note that if
your predicate throws, the insertion might fail, and your node would be
left unlinked. And the function would be really low-level and dangerous
if used without care. I don't know if this has some deep impact in
current design, but I will try to see it when I have a bit of time.

Meanwhile, I'm afraid you'll need a pointer to the set ;-)

Regards,

Ion


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