/**
A list of pointers.
- Use for list of pointers, e.g. PointerList<AbstractType*>.
+ Use for list of pointers, e.g. Link_list<AbstractType*>.
This class does no deletion of the pointers, but it knows how to
copy itself (shallow copy). We could have derived it from List<T>,
- but this design saves a lot of code dup; for all PointerLists in the
+ but this design saves a lot of code dup; for all Link_lists in the
program only one parent List<void*> is instantiated.
*/
template<class T>
-class PointerList : public List<void *>
+class Link_list : public List<void *>
{
public:
PCursor<T> top() const{
PCursor<T> bottom() const {
return PCursor<T> (List<void*>::bottom());
}
- PCursor<T> find(T) const;
- void concatenate(PointerList<T> const &s) { List<void*>::concatenate(s); }
- PointerList() {}
+ PCursor<T> find (T) const;
+ void concatenate (Link_list<T> const &s) { List<void*>::concatenate (s); }
+
+ Link_list() {}
};
-/** PointerList which deletes pointers given to it.
+/**
+
+ Link_list which deletes pointers given to it.
+
NOTE:
The copy constructor doesn't do what you'd want:
Since T might have a virtual ctor, we don't try to do a
- new T(*cursor)
+ new T(**cursor)
- You have to copy this yourself, or use the macro PointerList__copy
+ You have to copy this yourself, or use the macro Link_list__copy
+ TODO
+ operator =()
*/
template<class T>
-class IPointerList : public PointerList<T> {
+class Pointer_list : public Link_list<T> {
+
public:
- IPointerList(IPointerList const &) { set_empty(); }
- IPointerList() { }
- ~IPointerList();
+ void junk();
+ Pointer_list (Pointer_list const &) { set_empty(); }
+ Pointer_list() { }
+ ~Pointer_list() { junk (); }
};
-#define IPointerList__copy(T, to, from, op) \
+#define Pointer_list__copy(T, to, from, op) \
for (PCursor<T> _pc_(from); _pc_.ok(); _pc_++)\
- to.bottom().add(_pc_->op)\
+ to.bottom().add (_pc_->op)\
\
template<class T>
-void PL_copy(IPointerList<T*> &dst,IPointerList<T*> const&src);
+void PL_copy (Pointer_list<T*> &dst,Pointer_list<T*> const&src);