Mercurial > hg > octave-nkf
changeset 12153:e0e50f48df37
Explicitly disallow copying in some classes
author | Pascal Dupuis <Pascal.Dupuis@uclouvain.be> |
---|---|
date | Mon, 24 Jan 2011 14:57:07 -0500 |
parents | 8e1ab522c902 |
children | 22c99c8cfcb6 |
files | liboctave/Array.cc liboctave/ChangeLog liboctave/SparseQR.h liboctave/cmd-edit.cc src/ChangeLog src/ov-base-mat.h src/ov-range.h src/unwind-prot.h |
diffstat | 8 files changed, 66 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -383,6 +383,7 @@ return dest + nr*nc; } + private: // Recursive N-d generalized transpose @@ -417,11 +418,16 @@ return dest; } + // No copying! + + rec_permute_helper (const rec_permute_helper&); + + rec_permute_helper& operator = (const rec_permute_helper&); + public: template <class T> void permute (const T *src, T *dest) const { do_permute (src, dest, top); } - }; @@ -599,6 +605,12 @@ } } + // No copying! + + rec_index_helper (const rec_index_helper&); + + rec_index_helper& operator = (const rec_index_helper&); + public: template <class T> @@ -655,6 +667,7 @@ ~rec_resize_helper (void) { delete [] cext; } private: + // recursive resizing template <class T> void do_resize_fill (const T* src, T *dest, const T& rfv, int lev) const @@ -673,11 +686,18 @@ fill_or_memset (dext[lev] - k * dd, rfv, dest + k * dd); } } + + // No copying! + + rec_resize_helper (const rec_resize_helper&); + + rec_resize_helper& operator = (const rec_resize_helper&); + public: + template <class T> void resize_fill (const T* src, T *dest, const T& rfv) const { do_resize_fill (src, dest, rfv, n-1); } - }; template <class T>
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,10 @@ +2011-01-24 Pascal Dupuis <Pascal.Dupuis@worldonline.be> + + * SparseQR.h (class SparseQR::SparseQR_reps): Disallow copying. + * Array.cc (class rec_permute_helper, class rec_index_helper, + class rec_resize_helper): Likewise. + * cmd-edit.cc (class default_command_editor): Likewise. + 2011-01-22 Jaroslav Hajek <highegg@gmail.com> * oct-refcount.h: New source.
--- a/liboctave/SparseQR.h +++ b/liboctave/SparseQR.h @@ -73,11 +73,22 @@ CXSPARSE_DNAME (n) *N; #endif + + private: + + // No copying! + + SparseQR_rep (const SparseQR_rep&); + + SparseQR_rep& operator = (const SparseQR_rep&); }; + private: + SparseQR_rep *rep; public: + SparseQR (void) : rep (new SparseQR_rep (SparseMatrix(), 0)) { } SparseQR (const SparseMatrix& a, int order = 0) :
--- a/liboctave/cmd-edit.cc +++ b/liboctave/cmd-edit.cc @@ -753,6 +753,12 @@ FILE *input_stream; FILE *output_stream; + + // No copying! + + default_command_editor (const default_command_editor&); + + default_command_editor& operator = (const default_command_editor&); }; std::string
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-01-24 Pascal Dupuis <Pascal.Dupuis@worldonline.be> + + * ov-base-mat.h (class octave_base_matrix): Disallow assignment. + * ov-range.h (class octave_range): Likewise. + 2011-01-23 John W. Eaton <jwe@octave.org> * ov-struct.cc (octave_scalar_struct::print_raw):
--- a/src/ov-base-mat.h +++ b/src/ov-base-mat.h @@ -187,6 +187,12 @@ mutable MatrixType *typ; mutable idx_vector *idx_cache; + +private: + + // No assignment. + + octave_base_matrix& operator = (const octave_base_matrix&); }; #endif
--- a/src/ov-range.h +++ b/src/ov-range.h @@ -305,6 +305,10 @@ mutable idx_vector *idx_cache; + // No assignment. + + octave_range& operator = (const octave_range&); + DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
--- a/src/unwind-prot.h +++ b/src/unwind-prot.h @@ -127,14 +127,15 @@ void run (void) { (e_obj->*e_method) (); } private: - // No copying! XXX + + T *e_obj; + void (T::*e_method) (void); + + // No copying! method_elem (const method_elem&); method_elem operator = (const method_elem&); - - T *e_obj; - void (T::*e_method) (void); }; // An element that stores arbitrary variable, and restores it.