diff options
Diffstat (limited to 'src/list.h')
-rw-r--r-- | src/list.h | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -24,10 +24,18 @@ namespace Bu | |||
24 | ListLink *pPrev; | 24 | ListLink *pPrev; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | template<typename value, typename valuealloc, | 27 | template<typename value, typename valuealloc, typename linkalloc> |
28 | typename linkalloc> | 28 | class List; |
29 | |||
30 | template<typename value, typename valuealloc, typename linkalloc> | ||
29 | struct ListCore | 31 | struct ListCore |
30 | { | 32 | { |
33 | friend class List<value, valuealloc, linkalloc>; | ||
34 | friend class SharedCore< | ||
35 | List<value, valuealloc, linkalloc>, | ||
36 | ListCore<value, valuealloc, linkalloc> | ||
37 | >; | ||
38 | private: | ||
31 | typedef struct ListLink<value> Link; | 39 | typedef struct ListLink<value> Link; |
32 | ListCore() : | 40 | ListCore() : |
33 | pFirst( NULL ), | 41 | pFirst( NULL ), |
@@ -193,8 +201,10 @@ namespace Bu | |||
193 | */ | 201 | */ |
194 | template<typename value, typename valuealloc=std::allocator<value>, | 202 | template<typename value, typename valuealloc=std::allocator<value>, |
195 | typename linkalloc=std::allocator<struct ListLink<value> > > | 203 | typename linkalloc=std::allocator<struct ListLink<value> > > |
196 | class List : public SharedCore< struct ListCore<value, valuealloc, | 204 | class List : public SharedCore< |
197 | linkalloc> > | 205 | List<value, valuealloc, linkalloc>, |
206 | ListCore<value, valuealloc, linkalloc> | ||
207 | > | ||
198 | { | 208 | { |
199 | private: | 209 | private: |
200 | typedef struct ListLink<value> Link; | 210 | typedef struct ListLink<value> Link; |
@@ -202,9 +212,9 @@ namespace Bu | |||
202 | typedef struct ListCore<value, valuealloc, linkalloc> Core; | 212 | typedef struct ListCore<value, valuealloc, linkalloc> Core; |
203 | 213 | ||
204 | protected: | 214 | protected: |
205 | using SharedCore< Core >::core; | 215 | using SharedCore<MyType, Core>::core; |
206 | using SharedCore< Core >::_hardCopy; | 216 | using SharedCore<MyType, Core>::_hardCopy; |
207 | using SharedCore< Core >::_allocateCore; | 217 | using SharedCore<MyType, Core>::_allocateCore; |
208 | 218 | ||
209 | public: | 219 | public: |
210 | struct const_iterator; | 220 | struct const_iterator; |
@@ -215,7 +225,7 @@ namespace Bu | |||
215 | } | 225 | } |
216 | 226 | ||
217 | List( const MyType &src ) : | 227 | List( const MyType &src ) : |
218 | SharedCore< Core >( src ) | 228 | SharedCore<MyType, Core >( src ) |
219 | { | 229 | { |
220 | } | 230 | } |
221 | 231 | ||