From 867dae89929a11a421ec21af71d494ad0ecc1963 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 14 Oct 2010 23:26:25 +0000 Subject: SharedCore has more features now, which is cool, including a test to see if another object of the parent type has the same core, and another to clone the parent object. That one is pretty cool, it means you can now get a real copy when you want to, great for multi-threaded stuff. Also, two more classes are now SharedCore: Hash and Heap! --- src/array.h | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/array.h') diff --git a/src/array.h b/src/array.h index eeee677..fc4fb12 100644 --- a/src/array.h +++ b/src/array.h @@ -17,10 +17,18 @@ namespace Bu { subExceptionDecl( ArrayException ) + template + class Array; + template class ArrayCore { - public: + friend class Array; + friend class SharedCore< + Array, + ArrayCore + >; + private: ArrayCore() : pData( NULL ), iSize( 0 ), @@ -110,16 +118,20 @@ namespace Bu *@ingroup Containers */ template > - class Array : public SharedCore > + class Array : public SharedCore< + Array, + ArrayCore + > { private: typedef class Array MyType; typedef class ArrayCore Core; protected: - using SharedCore< Core >::core; - using SharedCore< Core >::_hardCopy; - using SharedCore< Core >::_allocateCore; + using SharedCore::core; + using SharedCore::_hardCopy; + using SharedCore::_resetCore; + using SharedCore::_allocateCore; public: struct const_iterator; @@ -130,7 +142,7 @@ namespace Bu } Array( const MyType &src ) : - SharedCore< Core >( src ) + SharedCore( src ) { } @@ -168,8 +180,7 @@ namespace Bu */ void clear() { - _hardCopy(); - core->clear(); + _resetCore(); } MyType &append( const value &rVal ) -- cgit v1.2.3