annotate liboctave/util/base-list.h @ 21139:538b57866b90

consistently use "typename" intead of "class" in template declarations * Object.h, QtHandlesUtils.cc, QtHandlesUtils.h, ToolBarButton.cc, ToolBarButton.h, Cell.h, __lin_interpn__.cc, bitfcns.cc, bsxfun.cc, cellfun.cc, data.cc, filter.cc, gcd.cc, graphics.cc, help.cc, kron.cc, lookup.cc, ls-mat5.cc, ls-oct-text.h, lu.cc, max.cc, mgorth.cc, oct-map.cc, oct-map.h, oct-stream.cc, oct-stream.h, octave-link.h, pr-output.cc, profiler.h, schur.cc, sparse-xdiv.cc, sparse-xpow.cc, sqrtm.cc, symtab.h, tril.cc, typecast.cc, variables.cc, xdiv.cc, zfstream.h, __init_fltk__.cc, __magick_read__.cc, chol.cc, qr.cc, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.h, ov-classdef.cc, ov-int-traits.h, ov-java.h, ov-usr-fcn.h, ov.cc, ov.h, op-dms-template.cc, oct-parse.in.yy, parse.h, pt-mat.cc, Array-b.cc, Array.cc, Array.h, CDiagMatrix.h, CMatrix.h, CNDArray.h, DiagArray2.cc, DiagArray2.h, MArray.cc, MArray.h, MDiagArray2.cc, MDiagArray2.h, MSparse.cc, MSparse.h, MatrixType.cc, Sparse.cc, Sparse.h, dDiagMatrix.h, dMatrix.h, dNDArray.h, fCDiagMatrix.h, fCMatrix.h, fCNDArray.h, fDiagMatrix.h, fMatrix.h, fNDArray.h, idx-vector.cc, idx-vector.h, intNDArray.cc, intNDArray.h, DET.h, base-aepbal.h, base-lu.cc, base-lu.h, base-qr.cc, base-qr.h, bsxfun-defs.cc, eigs-base.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, oct-convn.cc, oct-fftw.cc, oct-norm.cc, sparse-base-chol.cc, sparse-base-chol.h, sparse-base-lu.cc, sparse-base-lu.h, sparse-dmsolve.cc, mx-inlines.cc, action-container.h, base-list.h, lo-traits.h, lo-utils.h, oct-base64.h, oct-binmap.h, oct-cmplx.h, oct-inttypes.cc, oct-inttypes.h, oct-locbuf.h, oct-refcount.h, oct-sort.cc, oct-sort.h: Use "typename" instead of "class" in template declarations.
author John W. Eaton <jwe@octave.org>
date Sun, 24 Jan 2016 13:50:04 -0500
parents f7084eae3318
children 1473547f50f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
1 /*
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
2
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17856
diff changeset
3 Copyright (C) 2002-2015 John W. Eaton
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
4
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
6
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6842
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6842
diff changeset
10 option) any later version.
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
11
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
15 for more details.
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
16
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6842
diff changeset
18 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6842
diff changeset
19 <http://www.gnu.org/licenses/>.
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
20
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
21 */
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
23 #if ! defined (octave_base_list_h)
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
24 #define octave_base_list_h 1
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
25
16237
70f465930546 rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents: 15271
diff changeset
26 #include <cstdlib>
70f465930546 rearrange class heirarchy for tree_cell and tree_matrix
John W. Eaton <jwe@octave.org>
parents: 15271
diff changeset
27
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
28 #include <list>
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
29
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
30 template <typename elt_type>
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
31 class
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
32 octave_base_list
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
33 {
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
34 public:
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
35
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
36 typedef typename std::list<elt_type>::iterator iterator;
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
37 typedef typename std::list<elt_type>::const_iterator const_iterator;
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
38
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
39 typedef typename std::list<elt_type>::reverse_iterator reverse_iterator;
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
40 typedef typename std::list<elt_type>::const_reverse_iterator const_reverse_iterator;
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
41
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
42 bool empty (void) const { return lst.empty (); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
43
14023
d51b321b5fef move base-list.h from src to liboctave
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
44 size_t size (void) const { return lst.size (); }
d51b321b5fef move base-list.h from src to liboctave
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
45 size_t length (void) const { return size (); }
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
46
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
47 iterator erase (iterator pos) { return lst.erase (pos); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
48
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
49 template <typename P>
6841
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
50 void remove_if (P pred)
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
51 {
17198
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
52 lst.remove_if (pred);
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
53
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
54 // FIXME: kluge removed 8/7/13. Eventually this commented
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
55 // code should be deleted.
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
56 //
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
57 // FIXME: this kluge should be removed at some point.
6841
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
58 // We would like to simply call
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
59 //
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
60 // lst.remove_if (pred);
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
61 //
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
62 // but the Sun Studio compiler chokes on that.
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
63 //
17198
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
64 // iterator b = lst.begin ();
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
65 // iterator e = lst.end ();
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
66 // while (b != e)
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
67 // {
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
68 // iterator n = b;
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
69 // n++;
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
70 // if (pred (*b))
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
71 // lst.erase (b);
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
72 // b = n;
81f3b09e3e6e base-list.h: Switch to STL remove_if rather than Sun Compiler workaround.
Rik <rik@octave.org>
parents: 16627
diff changeset
73 // }
6841
9cee629fe20c [project @ 2007-08-29 17:31:45 by jwe]
jwe
parents: 5307
diff changeset
74 }
5142
0f9108f298ab [project @ 2005-02-12 02:29:34 by jwe]
jwe
parents: 4222
diff changeset
75
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
76 void clear (void) { lst.clear (); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
77
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
78 iterator begin (void) { return iterator (lst.begin ()); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
79 const_iterator begin (void) const { return const_iterator (lst.begin ()); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
80
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
81 iterator end (void) { return iterator (lst.end ()); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
82 const_iterator end (void) const { return const_iterator (lst.end ()); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
83
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
84 reverse_iterator rbegin (void) { return reverse_iterator (lst.rbegin ()); }
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
85 const_reverse_iterator rbegin (void) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
86 { return const_reverse_iterator (lst.rbegin ()); }
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
87
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
88 reverse_iterator rend (void) { return reverse_iterator (lst.rend ()); }
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
89 const_reverse_iterator rend (void) const
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
90 { return const_reverse_iterator (lst.rend ()); }
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16237
diff changeset
91
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
92 elt_type& front (void) { return lst.front (); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
93 elt_type& back (void) { return lst.back (); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
94
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
95 const elt_type& front (void) const { return lst.front (); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
96 const elt_type& back (void) const { return lst.back (); }
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
97
8470
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
98 void push_front (const elt_type& s) { lst.push_front (s); }
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
99 void push_back (const elt_type& s) { lst.push_back (s); }
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
100
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
101 void pop_front (void) { lst.pop_front (); }
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
102 void pop_back (void) { lst.pop_back (); }
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
103
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
104 // For backward compatibility.
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
105 void append (const elt_type& s) { lst.push_back (s); }
5da39b223f61 base-list.h (push_front, pop_front, push_back, pop_back): new functions.
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
106
11515
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
107 octave_base_list (void) : lst () { }
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
108
14023
d51b321b5fef move base-list.h from src to liboctave
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
109 octave_base_list (const std::list<elt_type>& l) : lst (l) { }
d51b321b5fef move base-list.h from src to liboctave
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
110
11515
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
111 octave_base_list (const octave_base_list& bl) : lst (bl.lst) { }
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
112
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
113 octave_base_list& operator = (const octave_base_list& bl)
17769
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
114 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
115 if (this != &bl)
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
116 {
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
117 lst = bl.lst;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
118 }
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
119 return *this;
49a5a4be04a1 maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents: 17744
diff changeset
120 }
11515
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
121
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
122 ~octave_base_list (void) { }
6dbf9bcce90e more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
123
4222
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
124 private:
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
125
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
126 std::list<elt_type> lst;
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
127 };
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
128
1363b7e9bf3a [project @ 2002-12-13 14:13:42 by jwe]
jwe
parents:
diff changeset
129 #endif