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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
4222
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_base_list_h) |
|
25 #define octave_base_list_h 1 |
|
26 |
|
27 #include <list> |
|
28 |
|
29 template <typename elt_type> |
|
30 class |
|
31 octave_base_list |
|
32 { |
|
33 public: |
|
34 |
|
35 typedef typename std::list<elt_type>::iterator iterator; |
|
36 typedef typename std::list<elt_type>::const_iterator const_iterator; |
|
37 |
|
38 bool empty (void) const { return lst.empty (); } |
|
39 |
|
40 size_t length (void) const { return lst.size (); } |
|
41 |
|
42 iterator erase (iterator pos) { return lst.erase (pos); } |
|
43 |
5142
|
44 template <class P> |
|
45 void remove_if (P pred) { lst.remove_if (pred); } |
|
46 |
4222
|
47 void clear (void) { lst.clear (); } |
|
48 |
|
49 void append (const elt_type& s) { lst.push_back (s); } |
|
50 |
|
51 iterator begin (void) { return iterator (lst.begin ()); } |
|
52 const_iterator begin (void) const { return const_iterator (lst.begin ()); } |
|
53 |
|
54 iterator end (void) { return iterator (lst.end ()); } |
|
55 const_iterator end (void) const { return const_iterator (lst.end ()); } |
|
56 |
|
57 elt_type& front (void) { return lst.front (); } |
|
58 elt_type& back (void) { return lst.back (); } |
|
59 |
|
60 const elt_type& front (void) const { return lst.front (); } |
|
61 const elt_type& back (void) const { return lst.back (); } |
|
62 |
|
63 private: |
|
64 |
|
65 std::list<elt_type> lst; |
|
66 }; |
|
67 |
|
68 #endif |
|
69 |
|
70 /* |
|
71 ;;; Local Variables: *** |
|
72 ;;; mode: C++ *** |
|
73 ;;; End: *** |
|
74 */ |