|
Boost : |
From: XHChen_at_[hidden]
Date: 2007-07-29 05:09:30
Hi All,
I studied the shared_ptr in the recent few days,
and found that it uses a global reference count to determine
when to delete the real pointer. The reference count is
created by operator new.
It is possible to remove the new operation by replacing
the reference count with a linked list structure. All shared_ptr
on the same real pointer should be linked in one list. Thus
the length of the link list is actually the reference count.
If a shared_ptr is destructed, it removes itself from the
link list. And then if no other shared_ptr on the link list, it delete
the real pointer.
Attachment is the simple implement for shared_ptr in the way
of linked list. Hopes that the method is useful and can be accepted.
Best regards,
Xhchen
===========================================================================================
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Winbond is strictly prohibited; and any information in this email irrelevant to the official business of Winbond shall be deemed as neither given nor endorsed by Winbond.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk