]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/drul-array.hh
release: 0.1.11
[lilypond.git] / lily / include / drul-array.hh
1 /*
2   drul-array.hh -- declare Drul_array
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef DRUL_ARRAY_HH
11 #define DRUL_ARRAY_HH
12
13 #include "direction.hh"
14
15 /**
16   Left/right or Up/down arrays. Drul is nicer sounding than udlr
17  */
18 template<class T>
19 struct Drul_array
20 {
21   T array_[2];
22   T &operator[] (Direction d)
23   {
24     assert (d==1 || d== -1);
25     return array_[(d+1)/2];
26   }
27   T operator[]  (Direction d) const
28   {
29     assert (d==1 || d== -1);
30     return array_[(d+1)/2];
31   }
32 };
33
34 #endif // DRUL_ARRAY_HH