diff options
Diffstat (limited to 'src/list.h')
-rw-r--r-- | src/list.h | 29 |
1 files changed, 21 insertions, 8 deletions
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | namespace Bu | 17 | namespace Bu |
18 | { | 18 | { |
19 | /** @cond DEVEL */ | ||
19 | template<typename value> | 20 | template<typename value> |
20 | struct ListLink | 21 | struct ListLink |
21 | { | 22 | { |
@@ -24,10 +25,18 @@ namespace Bu | |||
24 | ListLink *pPrev; | 25 | ListLink *pPrev; |
25 | }; | 26 | }; |
26 | 27 | ||
27 | template<typename value, typename valuealloc, | 28 | template<typename value, typename valuealloc, typename linkalloc> |
28 | typename linkalloc> | 29 | class List; |
30 | |||
31 | template<typename value, typename valuealloc, typename linkalloc> | ||
29 | struct ListCore | 32 | struct ListCore |
30 | { | 33 | { |
34 | friend class List<value, valuealloc, linkalloc>; | ||
35 | friend class SharedCore< | ||
36 | List<value, valuealloc, linkalloc>, | ||
37 | ListCore<value, valuealloc, linkalloc> | ||
38 | >; | ||
39 | private: | ||
31 | typedef struct ListLink<value> Link; | 40 | typedef struct ListLink<value> Link; |
32 | ListCore() : | 41 | ListCore() : |
33 | pFirst( NULL ), | 42 | pFirst( NULL ), |
@@ -177,6 +186,7 @@ namespace Bu | |||
177 | } | 186 | } |
178 | } | 187 | } |
179 | }; | 188 | }; |
189 | /** @endcond */ | ||
180 | 190 | ||
181 | /** | 191 | /** |
182 | * Linked list template container. This class is similar to the stl list | 192 | * Linked list template container. This class is similar to the stl list |
@@ -189,12 +199,15 @@ namespace Bu | |||
189 | *@param value (typename) The type of data to store in your list | 199 | *@param value (typename) The type of data to store in your list |
190 | *@param valuealloc (typename) Memory Allocator for your value type | 200 | *@param valuealloc (typename) Memory Allocator for your value type |
191 | *@param linkalloc (typename) Memory Allocator for the list links. | 201 | *@param linkalloc (typename) Memory Allocator for the list links. |
202 | *@extends SharedCore | ||
192 | *@ingroup Containers | 203 | *@ingroup Containers |
193 | */ | 204 | */ |
194 | template<typename value, typename valuealloc=std::allocator<value>, | 205 | template<typename value, typename valuealloc=std::allocator<value>, |
195 | typename linkalloc=std::allocator<struct ListLink<value> > > | 206 | typename linkalloc=std::allocator<struct ListLink<value> > > |
196 | class List : public SharedCore< struct ListCore<value, valuealloc, | 207 | class List /** @cond */ : public SharedCore< |
197 | linkalloc> > | 208 | List<value, valuealloc, linkalloc>, |
209 | ListCore<value, valuealloc, linkalloc> | ||
210 | > /** @endcond */ | ||
198 | { | 211 | { |
199 | private: | 212 | private: |
200 | typedef struct ListLink<value> Link; | 213 | typedef struct ListLink<value> Link; |
@@ -202,9 +215,9 @@ namespace Bu | |||
202 | typedef struct ListCore<value, valuealloc, linkalloc> Core; | 215 | typedef struct ListCore<value, valuealloc, linkalloc> Core; |
203 | 216 | ||
204 | protected: | 217 | protected: |
205 | using SharedCore< Core >::core; | 218 | using SharedCore<MyType, Core>::core; |
206 | using SharedCore< Core >::_hardCopy; | 219 | using SharedCore<MyType, Core>::_hardCopy; |
207 | using SharedCore< Core >::_allocateCore; | 220 | using SharedCore<MyType, Core>::_allocateCore; |
208 | 221 | ||
209 | public: | 222 | public: |
210 | struct const_iterator; | 223 | struct const_iterator; |
@@ -215,7 +228,7 @@ namespace Bu | |||
215 | } | 228 | } |
216 | 229 | ||
217 | List( const MyType &src ) : | 230 | List( const MyType &src ) : |
218 | SharedCore< Core >( src ) | 231 | SharedCore<MyType, Core >( src ) |
219 | { | 232 | { |
220 | } | 233 | } |
221 | 234 | ||