Boost logo

Boost :

From: Lorenzo Bettini (bettini_at_[hidden])
Date: 2005-06-07 01:50:28


Eric Niebler wrote:
> 2) Grab tracking_ptr.hpp from
> boost-sandbox/boost/xpressive/detail/utility (can also be found in
> xpressive.zip from the Boost Sandbox File Vault).
>
> I had to solve the same problem for xpressive, where regex objects can
> embed other regex objects, either "by value" or "by reference". This
> leads to all sorts of interesting cyclic ref-count scenarios. I use
> tracking_ptr to handle this.

indeed also my context has to do with regular expressions and mutual
cyclic ref-count scenarios (in source-highlight
http://www.gnu.org/software/src-highlite). As I said in a response to a
previous post, I solved the problem by storing weak pointers in the
cyclic structures and store a shared pointer into a list that is kept
alive for all the life of the cyclic structures.

>
> Unfortunately, tracking_ptr is not documented. I forces you to separate
> your object into a handle-body, where the body inherits from
> enable_reference_tracking<Body>, and the handle holds a
> tracking_ptr<Body>. There's more, but maybe you can figure out the rest
> by seeing how xpressive uses tracking_ptr.

OK, thanks!
        Lore

-- 
+-----------------------------------------------------+
|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://music.dsi.unifi.it         XKlaim language  |
|  http://www.lorenzobettini.it/purple    Cover Band  |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |
+-----------------------------------------------------+

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