Mercurial > hg > octave-nkf
diff liboctave/Array.cc @ 8028:f0fbf47c914c
avoid null pointer call in Array<T>::hermitian
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 23:33:03 +0200 |
parents | 762801c50b21 |
children | acfd80c08d60 |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -1262,11 +1262,21 @@ } template <class T> +static T +no_op_fcn (const T& x) +{ + return x; +} + +template <class T> Array<T> Array<T>::hermitian (T (*fcn) (const T&)) const { assert (ndims () == 2); + if (! fcn) + fcn = no_op_fcn<T>; + octave_idx_type nr = dim1 (); octave_idx_type nc = dim2 ();