Boost logo

Boost :

From: Lorenzo Bettini (bettini_at_[hidden])
Date: 2005-06-07 08:11:43

David Abrahams wrote:
> Lorenzo Bettini <bettini_at_[hidden]> writes:
>>David Abrahams wrote:
>>>Can you deal with deallocation of the whole network at once? It often
>>>works to maintain the nodes (C objects) in a container like a deque
>>>and let them link to one another with raw pointers.
>>>Otherwise you may be in need of a real GC.
>>I solved the problem in a (probably) not too elegant way: when I know
>>that I'm creating objects with mutual dependences say A and B I store
>>weak pointers, and I store a shared pointer to A and B into a list. As
>>long as the list survives the weak pointers are still valid. When I
>>want to deallocate everything, all I have to do is to deallocate the
>>list. This worked, and also valgrind says there are no leaks...
> The smart pointers may not be buying you much of anything in that
> case.

so what could be an alternative?


|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  PhD in Computer Science                            |
|  Dip. Sistemi e Informatica, Univ. di Firenze       |
|  Florence - Italy        (GNU/Linux User # 158233)  |
|  Home Page        :    |
|         XKlaim language  |
|    Cover Band  |
|           |
|              |
|       |
|    |

Boost list run by bdawes at, gregod at, cpdaniel at, john at