diff options
Diffstat (limited to 'src/array.h')
-rw-r--r-- | src/array.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/array.h b/src/array.h index eeee677..f225c97 100644 --- a/src/array.h +++ b/src/array.h | |||
@@ -18,9 +18,18 @@ 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 | /** @cond DEVEL */ | ||
24 | template<typename value, int inc, typename valuealloc> | ||
21 | class ArrayCore | 25 | class ArrayCore |
22 | { | 26 | { |
23 | public: | 27 | friend class Array<value, inc, valuealloc>; |
28 | friend class SharedCore< | ||
29 | Array<value, inc, valuealloc>, | ||
30 | ArrayCore<value, inc, valuealloc> | ||
31 | >; | ||
32 | private: | ||
24 | ArrayCore() : | 33 | ArrayCore() : |
25 | pData( NULL ), | 34 | pData( NULL ), |
26 | iSize( 0 ), | 35 | iSize( 0 ), |
@@ -99,6 +108,7 @@ namespace Bu | |||
99 | long iSize; | 108 | long iSize; |
100 | long iCapacity; | 109 | long iCapacity; |
101 | }; | 110 | }; |
111 | /** @endcond */ | ||
102 | 112 | ||
103 | /** | 113 | /** |
104 | * Array type container, just like a normal array only flexible and keeps | 114 | * Array type container, just like a normal array only flexible and keeps |
@@ -110,16 +120,20 @@ namespace Bu | |||
110 | *@ingroup Containers | 120 | *@ingroup Containers |
111 | */ | 121 | */ |
112 | template<typename value, int inc=10, typename valuealloc=std::allocator<value> > | 122 | template<typename value, int inc=10, typename valuealloc=std::allocator<value> > |
113 | class Array : public SharedCore<ArrayCore<value, inc, valuealloc> > | 123 | class Array : public SharedCore< |
124 | Array<value, inc, valuealloc>, | ||
125 | ArrayCore<value, inc, valuealloc> | ||
126 | > | ||
114 | { | 127 | { |
115 | private: | 128 | private: |
116 | typedef class Array<value, inc, valuealloc> MyType; | 129 | typedef class Array<value, inc, valuealloc> MyType; |
117 | typedef class ArrayCore<value, inc, valuealloc> Core; | 130 | typedef class ArrayCore<value, inc, valuealloc> Core; |
118 | 131 | ||
119 | protected: | 132 | protected: |
120 | using SharedCore< Core >::core; | 133 | using SharedCore<MyType, Core>::core; |
121 | using SharedCore< Core >::_hardCopy; | 134 | using SharedCore<MyType, Core>::_hardCopy; |
122 | using SharedCore< Core >::_allocateCore; | 135 | using SharedCore<MyType, Core>::_resetCore; |
136 | using SharedCore<MyType, Core>::_allocateCore; | ||
123 | 137 | ||
124 | public: | 138 | public: |
125 | struct const_iterator; | 139 | struct const_iterator; |
@@ -130,7 +144,7 @@ namespace Bu | |||
130 | } | 144 | } |
131 | 145 | ||
132 | Array( const MyType &src ) : | 146 | Array( const MyType &src ) : |
133 | SharedCore< Core >( src ) | 147 | SharedCore<MyType, Core >( src ) |
134 | { | 148 | { |
135 | } | 149 | } |
136 | 150 | ||
@@ -168,8 +182,7 @@ namespace Bu | |||
168 | */ | 182 | */ |
169 | void clear() | 183 | void clear() |
170 | { | 184 | { |
171 | _hardCopy(); | 185 | _resetCore(); |
172 | core->clear(); | ||
173 | } | 186 | } |
174 | 187 | ||
175 | MyType &append( const value &rVal ) | 188 | MyType &append( const value &rVal ) |