]> git.donarmstrong.com Git - lilypond.git/blob - flower/plist.inl
fb18c872413b6cfbd4691716fa37463c16bc5457
[lilypond.git] / flower / plist.inl
1 /* -*-c++-*-
2   plist.inl -- part of flowerlib
3
4   (c) 1996 Han-Wen Nienhuys& Jan Nieuwenhuizen
5 */
6
7 #ifndef PLIST_INL
8 #define PLIST_INL
9
10
11
12 template<class T>
13 inline
14 PointerList<T>::~PointerList()
15 {
16     Cursor<T> next(*this);
17     for ( Cursor<T> c( *this ); c.ok(); c = next ) {
18         next = c;
19         next++;
20         remove( c );            // PointerList::remove deletes the  real data
21     }
22 }
23
24 template<class T>
25 inline void
26 PointerList_print( PointerList<T> const & l  ) 
27 {
28     List<T>& promises_to_be_const = (List<T>&) l;
29     for ( Cursor<T> c( promises_to_be_const ); c.ok(); c++ )
30         (*c)->print();  
31 }
32
33 template<class T>
34 inline void
35 PL_copy(PointerList<T> &to,PointerList<T> const&src)
36 {
37     for (PCursor<T> pc(src); pc.ok(); pc++) {
38         T q = pc;
39         T p=new typeof(*q) (*q) ; // argh, how do i do this in ANSI-C++
40         to.bottom().add(p);
41     }
42 }
43 #endif