managing objects in std::list
Date: Tue, 15 Feb 2005 09:30:38 -0000
I have a collection of lists, something like this:
Now I add an Obj to one of the lists:
Then later on, the Obj wants to remove itself from whichever list it was put
in (it's only allowed to be in one list). What's the best way to do this
My best idea is: when adding an Obj to a list, the Obj has to store the
address of the list, and also an iterator to the current start of the list
(i.e. where it's just been added). Later it can use these to remove itself.
Anyone have anything smarter than this?
- Re: Ansi Common Lisp chapter 3 exercise 6
... ;;lists should be represented by using the cdr to point to the first ... (defun gov-car (lst) ... (cons lst (cons obj nil))) ...
- Re: Dynamic list name from a string
... # no intermediary lists needed really. ... # make a sorted, by date, list of bears ... animals = [obj for obj in ns.Animals] ...
- For Each DistListItem and Runtime Error 13
... I am attempting to list the distribution lists in my ... Dim obj As Object ... Dim oDistList As Outlook.DistListItem ... Dim oItems As Outlook.Items ...
- Re: define_method and instance variable maddness
... def add_personnel ... It looks like you are maintaining multiple lists but I don't ... Why not just use a hash ... def add(list, obj) ...
- Re: mutable list iterators - a proposal
... > Replacing items, which is by far the most common need, works fine. ... >> through which the iterator has already passed, ... The fact that lists don't ... def SetBottom: ...