aboutsummaryrefslogtreecommitdiff
path: root/src/array.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/array.h')
-rw-r--r--src/array.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/array.h b/src/array.h
index eeee677..fc4fb12 100644
--- a/src/array.h
+++ b/src/array.h
@@ -18,9 +18,17 @@ namespace Bu
18 subExceptionDecl( ArrayException ) 18 subExceptionDecl( ArrayException )
19 19
20 template<typename value, int inc, typename valuealloc> 20 template<typename value, int inc, typename valuealloc>
21 class Array;
22
23 template<typename value, int inc, typename valuealloc>
21 class ArrayCore 24 class ArrayCore
22 { 25 {
23 public: 26 friend class Array<value, inc, valuealloc>;
27 friend class SharedCore<
28 Array<value, inc, valuealloc>,
29 ArrayCore<value, inc, valuealloc>
30 >;
31 private:
24 ArrayCore() : 32 ArrayCore() :
25 pData( NULL ), 33 pData( NULL ),
26 iSize( 0 ), 34 iSize( 0 ),
@@ -110,16 +118,20 @@ namespace Bu
110 *@ingroup Containers 118 *@ingroup Containers
111 */ 119 */
112 template<typename value, int inc=10, typename valuealloc=std::allocator<value> > 120 template<typename value, int inc=10, typename valuealloc=std::allocator<value> >
113 class Array : public SharedCore<ArrayCore<value, inc, valuealloc> > 121 class Array : public SharedCore<
122 Array<value, inc, valuealloc>,
123 ArrayCore<value, inc, valuealloc>
124 >
114 { 125 {
115 private: 126 private:
116 typedef class Array<value, inc, valuealloc> MyType; 127 typedef class Array<value, inc, valuealloc> MyType;
117 typedef class ArrayCore<value, inc, valuealloc> Core; 128 typedef class ArrayCore<value, inc, valuealloc> Core;
118 129
119 protected: 130 protected:
120 using SharedCore< Core >::core; 131 using SharedCore<MyType, Core>::core;
121 using SharedCore< Core >::_hardCopy; 132 using SharedCore<MyType, Core>::_hardCopy;
122 using SharedCore< Core >::_allocateCore; 133 using SharedCore<MyType, Core>::_resetCore;
134 using SharedCore<MyType, Core>::_allocateCore;
123 135
124 public: 136 public:
125 struct const_iterator; 137 struct const_iterator;
@@ -130,7 +142,7 @@ namespace Bu
130 } 142 }
131 143
132 Array( const MyType &src ) : 144 Array( const MyType &src ) :
133 SharedCore< Core >( src ) 145 SharedCore<MyType, Core >( src )
134 { 146 {
135 } 147 }
136 148
@@ -168,8 +180,7 @@ namespace Bu
168 */ 180 */
169 void clear() 181 void clear()
170 { 182 {
171 _hardCopy(); 183 _resetCore();
172 core->clear();
173 } 184 }
174 185
175 MyType &append( const value &rVal ) 186 MyType &append( const value &rVal )