4222
|
1 /* |
|
2 |
|
3 Copyright (C) 2002 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_base_list_h) |
|
24 #define octave_base_list_h 1 |
|
25 |
|
26 #include <list> |
|
27 |
|
28 template <typename elt_type> |
|
29 class |
|
30 octave_base_list |
|
31 { |
|
32 public: |
|
33 |
|
34 typedef typename std::list<elt_type>::iterator iterator; |
|
35 typedef typename std::list<elt_type>::const_iterator const_iterator; |
|
36 |
|
37 bool empty (void) const { return lst.empty (); } |
|
38 |
|
39 size_t length (void) const { return lst.size (); } |
|
40 |
|
41 iterator erase (iterator pos) { return lst.erase (pos); } |
|
42 |
|
43 void clear (void) { lst.clear (); } |
|
44 |
|
45 void append (const elt_type& s) { lst.push_back (s); } |
|
46 |
|
47 iterator begin (void) { return iterator (lst.begin ()); } |
|
48 const_iterator begin (void) const { return const_iterator (lst.begin ()); } |
|
49 |
|
50 iterator end (void) { return iterator (lst.end ()); } |
|
51 const_iterator end (void) const { return const_iterator (lst.end ()); } |
|
52 |
|
53 elt_type& front (void) { return lst.front (); } |
|
54 elt_type& back (void) { return lst.back (); } |
|
55 |
|
56 const elt_type& front (void) const { return lst.front (); } |
|
57 const elt_type& back (void) const { return lst.back (); } |
|
58 |
|
59 private: |
|
60 |
|
61 std::list<elt_type> lst; |
|
62 }; |
|
63 |
|
64 #endif |
|
65 |
|
66 /* |
|
67 ;;; Local Variables: *** |
|
68 ;;; mode: C++ *** |
|
69 ;;; End: *** |
|
70 */ |