diff src/ov-scalar.h @ 2477:3d905d3820a4

[project @ 1996-11-07 16:46:11 by jwe]
author jwe
date Thu, 07 Nov 1996 16:48:16 +0000
parents 1573640a9994
children 8b262e771614
line wrap: on
line diff
--- a/src/ov-scalar.h	Thu Nov 07 05:16:55 1996 +0000
+++ b/src/ov-scalar.h	Thu Nov 07 16:48:16 1996 +0000
@@ -35,6 +35,7 @@
 
 #include "lo-utils.h"
 #include "mx-base.h"
+#include "oct-alloc.h"
 #include "str-vec.h"
 
 #include "mappers.h"
@@ -66,10 +67,11 @@
 
   octave_value *clone (void) { return new octave_scalar (*this); }
 
-#if 0
-  void *operator new (size_t size);
-  void operator delete (void *p, size_t size);
-#endif
+  void *operator new (size_t size)
+    { return allocator.alloc (size); }
+
+  void operator delete (void *p, size_t size)
+    { allocator.free (p, size); }
 
   octave_value index (const octave_value_list& idx) const;
 
@@ -132,10 +134,16 @@
 
 private:
 
+  // The value of this scalar.
   double scalar;
 
+  // For custom memory management.
+  static octave_allocator allocator;
+
+  // Type id of scalar objects, set by register_type().
   static int t_id;
 
+  // Type name of scalar objects, defined in ov-scalar.cc.
   static const string t_name;
 };