[ scummvm-Patches-1895703 ] COMMON: Managed List

SourceForge.net noreply at sourceforge.net
Mon Feb 18 00:37:06 CET 2008


Patches item #1895703, was opened at 2008-02-18 00:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=1895703&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Johannes Schickel (lordhoto)
Assigned to: Nobody/Anonymous (nobody)
Summary: COMMON: Managed List

Initial Comment:
I got to know that some people are asking for a 'managed' List implementation in a common place. Currently lure and parallaction implement their own ManagedList, so we got some code duplication.

This patch adds support to auto free entries of Common::List, when specified. To achieve this it specializes Common::List for pointers and adds a _autoFree flag for it which can be set via the constructor.

The patch also has some downsides and left to be done things:

FIXME:
- find a nice solution for copying lists via "operator =" or the copy constructor, currently copied lists always use "_autoFree = false" to prevent double frees.

DOWNSIDES:
- currently "operator delete" is used and thus the implementation can not be used for allocated arrays as entries.
(maybe it could be added that the user can specify a deletion operator via a template parameter and a function pointer passed via constructor)

There are of course other ways to make Common::List (and also other containers) auto free objects, for example we could implement something like boost::shared_ptr which takes care of freeing the object when no more references are to it exist. This patch is just modelled after the way lure and parallaction are handling it though.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=1895703&group_id=37116




More information about the Scummvm-tracker mailing list