Overview
Features
Download
Documentation
Community
Add-Ons & Services

Weak pointers support

Discussion of ideas for features and new projects based on POCO.

Weak pointers support

Postby cdelmas » 22 May 2007, 16:07

Is it planned to add support to weak pointers to Poco ?
cdelmas
 
Posts: 46
Joined: 22 Sep 2006, 10:04
Location: France

Re: Weak pointers support

Postby cdelmas » 09 Aug 2007, 15:39

> Is it planned to add support to weak pointers to Poco ?

A "weak pointer" is a reference object (same kind as SharedPtr) but doens't have any responsibility about resource management.

A resource held by a SharedPtr is freed when reference count falls to 0. If this resource is also held by a WeakPtr, it is freed even if there are many WeakPtr pointing to it.

WeakPtr may not define -> and * operators, and may only return a SharedPtr (or a SharedPtr may be constructed from a WeakPtr) to the pointed object, or SharedPtr(0) if the resource has been cleaned.

For this to work, the count may be implemented as a pointer to an object (ReferenceCounter ?).

Thank you for your answers and suggestions.
cdelmas
 
Posts: 46
Joined: 22 Sep 2006, 10:04
Location: France

Re: Weak pointers support

Postby alex » 09 Aug 2007, 17:40

> Is it planned to add support to weak pointers to Poco ?

AFAIK, there is no immediate plan for it. I would not mind having it, though. If nobody has any objection, I'd say, go ahead and write it (probably the easiest way is to "pocoize" the boost::weak_ptr).

Alex
alex
 
Posts: 1048
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Wishlist

Who is online

Users browsing this forum: No registered users and 1 guest

cron