hudson::SmallList< Item > Class Template Reference
#include <SmallList.h>
Inheritance diagram for hudson::SmallList< Item >:
List of all members.
Detailed Description
template<class Item>
class hudson::SmallList< Item >
A list with premium on being small. We achieve this in four ways:
- no tail pointer
- no size counter
- singly-linked
- use SmallMemoryPool for the nodes, which has no malloc overhead (unless the payload is very large).
To implement constant-time insert/erase with a singly-linked list, the iterator class has a prev field. Note that end() is constant time, but we don't have a tail pointer. Therefore, insert(end()) is linear time. However, if we have an iterator that walked all the way to the end(), its prev is valid, so insert(it) is constant time even if it == end() is true -- but only if we walked it from begin() to end().
To reduce temptations, size() and *_back() are not declared.
Every insert function has a no-arg version that allows inserting elements that do not have copy constructors. Of course, these must have default constructors.
Member Typedef Documentation
Constructor & Destructor Documentation
|
|
Must have a copy ctor for Item |
Member Function Documentation
|
|
Merge two lists; fundamental operation in merge sort. The argument is destroyed, and the current list modified in place. No items are copied: we just steal nodes. |
|
|
Must have a copy ctor for Item |
|
template<class Item> |
|
template<class ItemCtorArg> |
| void hudson::SmallList< Item >::push_front |
( |
const ItemCtorArg & |
arg |
) |
[inline] |
|
|
|
Reverse in linear time, but with no copying. |
|
|
Remove duplicates from the list. |
The documentation for this class was generated from the following file:
Generated on Thu Mar 27 19:04:16 2008 by
1.4.6