> Yes I figured it out immediately after posting. I tried fixing it by
> adding a duplicate instance in the vector before adding it to the
> tree, but the trouble with that seems to be that push_back()s that
> cause resize()s make the object invalid. So I guess a list is a
> better structure to hold objects for the lifetime of the avltree?
Or try deque if you just need to add and not erase. Anyway, why do you need Boost.Intrusive if you are going to copy the value? Isn't better to use std::set and forget Boost.Intrusive?
The intent is to use a BST which can easily be coaxed
into using smart pointers. I don't see how this is possible without an intrusive container, which std::set is not (well, discounting the.Allocator).
I'm not writing a real application, more like a test program to observe the memory signatures of rebalancing, controlled pointer-chasing and such (at a low-level). I would be much happier not duplicating the value at all. I want the lifetime of the objects to persist, which means I can't insert objects created on the stack and malloc/new isn't an option due to the nature of my runtime (a simulated machine). So what I need is a BST that manages lifetime internally (like std::set) but allows me to dictate raw/smart pointer types (like boost::avltree). I realize I might be asking for too much :).
Ion
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users