util
KDevelop::ConvenientFreeListSet< Data, Handler > Class Template Reference
This is a simple set implementation based on the embedded free tree algorithms. More...
#include <convenientfreelist.h>
Public Types | |
|
typedef ConvenientEmbeddedSetIterator < Data, Handler > | Iterator |
Public Member Functions | |
| ConvenientFreeListSet (int centralFreeItem, QVector< Data > data) | |
| int | centralFreeItem () const |
| bool | contains (const Data &item) const |
| const QVector< Data > & | data () const |
| void | insert (const Data &item) |
| Iterator | iterator () const |
| void | remove (const Data &item) |
Detailed Description
template<class Data, class Handler>
class KDevelop::ConvenientFreeListSet< Data, Handler >
This is a simple set implementation based on the embedded free tree algorithms.
The core advantage of the whole thing is that the wole set is represented by a consecutive memory-area, and thus can be stored or copied using a simple memcpy. However in many cases it's better using the algorithms directly in such cases.
However even for normal tasks this implementation does have some advantages over std::set:
- Many times faster iteration through contained data
- Lower memory-usage if the objects are small, since there is no heap allocation overhead
- Can be combined with other embedded-free-list based sets using algorithms in ConstantConvenientEmbeddedSet Disadvantages:
- Significantly slower insertion
Definition at line 685 of file convenientfreelist.h.
Constructor & Destructor Documentation
| KDevelop::ConvenientFreeListSet< Data, Handler >::ConvenientFreeListSet | ( | int | centralFreeItem, | |
| QVector< Data > | data | |||
| ) | [inline] |
Re-construct a set from its components.
Definition at line 694 of file convenientfreelist.h.
Member Function Documentation
| int KDevelop::ConvenientFreeListSet< Data, Handler >::centralFreeItem | ( | ) | const [inline] |
You can use this to store the set to disk and later give it together with data() to the constructor, thus reconstructing it.
Definition at line 698 of file convenientfreelist.h.
The documentation for this class was generated from the following file:
KDE 4.4 API Reference