summaryrefslogtreecommitdiff
path: root/flower/plist.inl
blob: b8cd8d602099a39268c89db40b3636091d618a55 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* -*-c++-*-
  plist.inl -- part of flowerlib

  (c) 1996 Han-Wen Nienhuys& Jan Nieuwenhuizen
*/

#ifndef PLIST_INL
#define PLIST_INL



template<class T>
inline
PointerList<T>::~PointerList()
{
    Cursor<T> next(*this);
    for ( Cursor<T> c( *this ); c.ok(); c = next ) {
	next = c;
	next++;
	remove( c );		// PointerList::remove deletes the  real data
    }
}

template<class T>
inline void
PointerList_print( PointerList<T> const & l  ) 
{
    for (PCursor<T> c(l ); c.ok(); c++ )
        c->print();  
}

template<class T>
inline void
PL_copy(PointerList<T*> &to,PointerList<T*> const&src)
{
    for (PCursor<T*> pc(src); pc.ok(); pc++) {
	T *q = pc;
	T *p=new T(*q) ; // argh, how do i do this in ANSI-C++
	to.bottom().add(p);
    }
}
#endif