# HG changeset patch # User Jaroslav Hajek # Date 1251057603 -7200 # Node ID 948795dc19747a05b45acde73e572ee6ae22f508 # Parent 76ecc571879ea37c14fffada007d7b204b099155 make a few Array methods inline diff -r 76ecc571879e -r 948795dc1974 liboctave/Array.cc --- a/liboctave/Array.cc Sun Aug 23 05:57:51 2009 +0200 +++ b/liboctave/Array.cc Sun Aug 23 22:00:03 2009 +0200 @@ -46,18 +46,6 @@ // all the derived classes. template -void -Array::make_unique (void) -{ - if (rep->count > 1) - { - --rep->count; - rep = new ArrayRep (slice_data, slice_len, true); - slice_data = rep->data; - } -} - -template Array::Array (const Array& a, const dim_vector& dv) : rep (a.rep), dimensions (dv), slice_data (a.slice_data), slice_len (a.slice_len) @@ -70,33 +58,6 @@ } template -Array::~Array (void) -{ - if (--rep->count <= 0) - delete rep; -} - -template -Array& -Array::operator = (const Array& a) -{ - if (this != &a) - { - if (--rep->count <= 0) - delete rep; - - rep = a.rep; - rep->count++; - - dimensions = a.dimensions; - slice_data = a.slice_data; - slice_len = a.slice_len; - } - - return *this; -} - -template void Array::fill (const T& val) { diff -r 76ecc571879e -r 948795dc1974 liboctave/Array.h --- a/liboctave/Array.h Sun Aug 23 05:57:51 2009 +0200 +++ b/liboctave/Array.h Sun Aug 23 22:00:03 2009 +0200 @@ -98,7 +98,15 @@ public: - void make_unique (void); + void make_unique (void) + { + if (rep->count > 1) + { + --rep->count; + rep = new ArrayRep (slice_data, slice_len, true); + slice_data = rep->data; + } + } typedef T element_type; @@ -233,9 +241,29 @@ Array (const Array& a, const dim_vector& dv); - virtual ~Array (void); + ~Array (void) + { + if (--rep->count <= 0) + delete rep; + } - Array& operator = (const Array& a); + Array& operator = (const Array& a) + { + if (this != &a) + { + if (--rep->count <= 0) + delete rep; + + rep = a.rep; + rep->count++; + + dimensions = a.dimensions; + slice_data = a.slice_data; + slice_len = a.slice_len; + } + + return *this; + } void fill (const T& val); void clear (void); diff -r 76ecc571879e -r 948795dc1974 liboctave/ChangeLog --- a/liboctave/ChangeLog Sun Aug 23 05:57:51 2009 +0200 +++ b/liboctave/ChangeLog Sun Aug 23 22:00:03 2009 +0200 @@ -1,3 +1,9 @@ +2009-08-23 Jaroslav Hajek + + * Array.h (Array::make_unique, Array::~Array, Array::operator =): + Move here to allow inlining. + * Array.cc: Remove from here. + 2009-08-20 Jaroslav Hajek * mx-inlines.cc (logical_value): New overloaded template.