diff src/ov-cell.h @ 10065:64a06079cae4

improve cellstr cache implementation
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 05 Jan 2010 13:16:16 +0100
parents b3089dba88bf
children 090173f2db40
line wrap: on
line diff
--- a/src/ov-cell.h	Wed Jan 06 07:49:40 2010 -0500
+++ b/src/ov-cell.h	Tue Jan 05 13:16:16 2010 +0100
@@ -28,6 +28,7 @@
 
 #include <iosfwd>
 #include <string>
+#include <memory>
 
 #include "mx-base.h"
 #include "oct-alloc.h"
@@ -57,7 +58,7 @@
     : octave_base_matrix<Cell> (c) { }
 
   octave_cell (const Array<std::string>& str)
-    : octave_base_matrix<Cell> (Cell (str)), cellstr_cache (str) { }
+    : octave_base_matrix<Cell> (Cell (str)), cellstr_cache (new Array<std::string> (str)) { }
 
   octave_cell (const octave_cell& c)
     : octave_base_matrix<Cell> (c) { }
@@ -165,11 +166,10 @@
 
 private:
 
-  void clear_cellstr_cache (void) const;
+  void clear_cellstr_cache (void) const
+    { cellstr_cache.reset (); }
 
-  mutable Array<std::string> cellstr_cache;
-
-  void make_cellstr_cache (void) const;
+  mutable std::auto_ptr<Array<std::string> > cellstr_cache;
 
   DECLARE_OCTAVE_ALLOCATOR