Mercurial > jwe > octave
comparison liboctave/util/action-container.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 |
comparison
equal
deleted
inserted
replaced
21138:e2fca7d79169 | 21139:538b57866b90 |
---|---|
72 }; | 72 }; |
73 | 73 |
74 // An element that stores a variable of type T along with a void (*) (T) | 74 // An element that stores a variable of type T along with a void (*) (T) |
75 // function pointer, and calls the function with the parameter. | 75 // function pointer, and calls the function with the parameter. |
76 | 76 |
77 template <class T> | 77 template <typename T> |
78 class fcn_arg_elem : public elem | 78 class fcn_arg_elem : public elem |
79 { | 79 { |
80 public: | 80 public: |
81 fcn_arg_elem (void (*fcn) (T), T arg) | 81 fcn_arg_elem (void (*fcn) (T), T arg) |
82 : e_fcn (fcn), e_arg (arg) { } | 82 : e_fcn (fcn), e_arg (arg) { } |
97 | 97 |
98 // An element that stores a variable of type T along with a | 98 // An element that stores a variable of type T along with a |
99 // void (*) (const T&) function pointer, and calls the function with | 99 // void (*) (const T&) function pointer, and calls the function with |
100 // the parameter. | 100 // the parameter. |
101 | 101 |
102 template <class T> | 102 template <typename T> |
103 class fcn_crefarg_elem : public elem | 103 class fcn_crefarg_elem : public elem |
104 { | 104 { |
105 public: | 105 public: |
106 fcn_crefarg_elem (void (*fcn) (const T&), const T& arg) | 106 fcn_crefarg_elem (void (*fcn) (const T&), const T& arg) |
107 : e_fcn (fcn), e_arg (arg) { } | 107 : e_fcn (fcn), e_arg (arg) { } |
113 T e_arg; | 113 T e_arg; |
114 }; | 114 }; |
115 | 115 |
116 // An element for calling a member function. | 116 // An element for calling a member function. |
117 | 117 |
118 template <class T> | 118 template <typename T> |
119 class method_elem : public elem | 119 class method_elem : public elem |
120 { | 120 { |
121 public: | 121 public: |
122 method_elem (T *obj, void (T::*method) (void)) | 122 method_elem (T *obj, void (T::*method) (void)) |
123 : e_obj (obj), e_method (method) { } | 123 : e_obj (obj), e_method (method) { } |
136 method_elem operator = (const method_elem&); | 136 method_elem operator = (const method_elem&); |
137 }; | 137 }; |
138 | 138 |
139 // An element for calling a member function with a single argument | 139 // An element for calling a member function with a single argument |
140 | 140 |
141 template <class T, class A> | 141 template <typename T, typename A> |
142 class method_arg_elem : public elem | 142 class method_arg_elem : public elem |
143 { | 143 { |
144 public: | 144 public: |
145 method_arg_elem (T *obj, void (T::*method) (A), A arg) | 145 method_arg_elem (T *obj, void (T::*method) (A), A arg) |
146 : e_obj (obj), e_method (method), e_arg (arg) { } | 146 : e_obj (obj), e_method (method), e_arg (arg) { } |
160 method_arg_elem operator = (const method_arg_elem&); | 160 method_arg_elem operator = (const method_arg_elem&); |
161 }; | 161 }; |
162 | 162 |
163 // An element for calling a member function with a single argument | 163 // An element for calling a member function with a single argument |
164 | 164 |
165 template <class T, class A> | 165 template <typename T, typename A> |
166 class method_crefarg_elem : public elem | 166 class method_crefarg_elem : public elem |
167 { | 167 { |
168 public: | 168 public: |
169 method_crefarg_elem (T *obj, void (T::*method) (const A&), const A& arg) | 169 method_crefarg_elem (T *obj, void (T::*method) (const A&), const A& arg) |
170 : e_obj (obj), e_method (method), e_arg (arg) { } | 170 : e_obj (obj), e_method (method), e_arg (arg) { } |
184 method_crefarg_elem operator = (const method_crefarg_elem&); | 184 method_crefarg_elem operator = (const method_crefarg_elem&); |
185 }; | 185 }; |
186 | 186 |
187 // An element that stores arbitrary variable, and restores it. | 187 // An element that stores arbitrary variable, and restores it. |
188 | 188 |
189 template <class T> | 189 template <typename T> |
190 class restore_var_elem : public elem | 190 class restore_var_elem : public elem |
191 { | 191 { |
192 public: | 192 public: |
193 restore_var_elem (T& ref, const T& val) | 193 restore_var_elem (T& ref, const T& val) |
194 : e_ptr (&ref), e_val (val) { } | 194 : e_ptr (&ref), e_val (val) { } |
206 T *e_ptr, e_val; | 206 T *e_ptr, e_val; |
207 }; | 207 }; |
208 | 208 |
209 // Deletes a class allocated using new. | 209 // Deletes a class allocated using new. |
210 | 210 |
211 template <class T> | 211 template <typename T> |
212 class delete_ptr_elem : public elem | 212 class delete_ptr_elem : public elem |
213 { | 213 { |
214 public: | 214 public: |
215 delete_ptr_elem (T *ptr) | 215 delete_ptr_elem (T *ptr) |
216 : e_ptr (ptr) { } | 216 : e_ptr (ptr) { } |
239 { | 239 { |
240 add (new fcn_elem (fcn)); | 240 add (new fcn_elem (fcn)); |
241 } | 241 } |
242 | 242 |
243 // Call to void func (T). | 243 // Call to void func (T). |
244 template <class T> | 244 template <typename T> |
245 void add_fcn (void (*action) (T), T val) | 245 void add_fcn (void (*action) (T), T val) |
246 { | 246 { |
247 add (new fcn_arg_elem<T> (action, val)); | 247 add (new fcn_arg_elem<T> (action, val)); |
248 } | 248 } |
249 | 249 |
250 // Call to void func (const T&). | 250 // Call to void func (const T&). |
251 template <class T> | 251 template <typename T> |
252 void add_fcn (void (*action) (const T&), const T& val) | 252 void add_fcn (void (*action) (const T&), const T& val) |
253 { | 253 { |
254 add (new fcn_crefarg_elem<T> (action, val)); | 254 add (new fcn_crefarg_elem<T> (action, val)); |
255 } | 255 } |
256 | 256 |
257 // Call to T::method (void). | 257 // Call to T::method (void). |
258 template <class T> | 258 template <typename T> |
259 void add_method (T *obj, void (T::*method) (void)) | 259 void add_method (T *obj, void (T::*method) (void)) |
260 { | 260 { |
261 add (new method_elem<T> (obj, method)); | 261 add (new method_elem<T> (obj, method)); |
262 } | 262 } |
263 | 263 |
264 // Call to T::method (A). | 264 // Call to T::method (A). |
265 template <class T, class A> | 265 template <typename T, typename A> |
266 void add_method (T *obj, void (T::*method) (A), A arg) | 266 void add_method (T *obj, void (T::*method) (A), A arg) |
267 { | 267 { |
268 add (new method_arg_elem<T, A> (obj, method, arg)); | 268 add (new method_arg_elem<T, A> (obj, method, arg)); |
269 } | 269 } |
270 | 270 |
271 // Call to T::method (const A&). | 271 // Call to T::method (const A&). |
272 template <class T, class A> | 272 template <typename T, typename A> |
273 void add_method (T *obj, void (T::*method) (const A&), const A& arg) | 273 void add_method (T *obj, void (T::*method) (const A&), const A& arg) |
274 { | 274 { |
275 add (new method_crefarg_elem<T, A> (obj, method, arg)); | 275 add (new method_crefarg_elem<T, A> (obj, method, arg)); |
276 } | 276 } |
277 | 277 |
278 // Call to delete (T*). | 278 // Call to delete (T*). |
279 | 279 |
280 template <class T> | 280 template <typename T> |
281 void add_delete (T *obj) | 281 void add_delete (T *obj) |
282 { | 282 { |
283 add (new delete_ptr_elem<T> (obj)); | 283 add (new delete_ptr_elem<T> (obj)); |
284 } | 284 } |
285 | 285 |
286 // Protect any variable. | 286 // Protect any variable. |
287 template <class T> | 287 template <typename T> |
288 void protect_var (T& var) | 288 void protect_var (T& var) |
289 { | 289 { |
290 add (new restore_var_elem<T> (var, var)); | 290 add (new restore_var_elem<T> (var, var)); |
291 } | 291 } |
292 | 292 |
293 // Protect any variable, value given. | 293 // Protect any variable, value given. |
294 template <class T> | 294 template <typename T> |
295 void protect_var (T& var, const T& val) | 295 void protect_var (T& var, const T& val) |
296 { | 296 { |
297 add (new restore_var_elem<T> (var, val)); | 297 add (new restore_var_elem<T> (var, val)); |
298 } | 298 } |
299 | 299 |