]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/parray.hh
release: 0.0.61
[lilypond.git] / flower / include / parray.hh
1 /*
2   parray.hh -- declare Pointer_array
3
4   source file of the Flower Library
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef PARRAY_HH
11 #define PARRAY_HH
12
13 #include "varray.hh"
14
15 template<class T>
16 class Pointer_array : public Array<T>
17 {
18 public:
19     int find_i (T t) const{
20         for (int i=0; i < size(); i++)
21             if (elem(i) == t)
22                 return i;
23         return -1;
24     }
25     T find_l(T t)const
26     {
27         int i = find_i(t);
28         if (i >= 0)
29             return elem(i);
30         else
31             return 0;
32     }
33 };
34 #endif // PARRAY_HH