|
| | treeMap (Compare comp=Compare{}, ALLOC alloc=ALLOC{}) |
| | Constructs empty treeMap.
|
| |
| | treeMap (const treeMap &other) |
| | Copy constructor.
|
| |
| treeMap & | operator= (const treeMap &other) |
| | Copy assignment operator.
|
| |
| | treeMap (treeMap &&other) noexcept |
| | Move constructor.
|
| |
| treeMap & | operator= (treeMap &&other) noexcept |
| | Move assignment operator.
|
| |
| u_integer | size () const override |
| | Gets number of elements.
|
| |
| bool | contains (const couple< const K_TYPE, V_TYPE > &e) const override |
| | Checks if key-value pair exists.
|
| |
| bool | add (const K_TYPE &k, const V_TYPE &v) override |
| | Adds new key-value pair.
|
| |
| bool | remove (const K_TYPE &k) override |
| | Removes key-value pair.
|
| |
| bool | containsKey (const K_TYPE &k) const override |
| | Checks if key exists.
|
| |
| V_TYPE | get (const K_TYPE &k) const override |
| | Gets value for key.
|
| |
| bool | update (const K_TYPE &key, const V_TYPE &value) override |
| | Updates value for existing key.
|
| |
| const V_TYPE & | operator[] (const K_TYPE &k) const override |
| | Const element access.
|
| |
| V_TYPE & | operator[] (const K_TYPE &k) override |
| | Non-const element access.
|
| |
| Iterator * | begins () const override |
| | Gets begin iterator.
|
| |
| Iterator * | ends () const override |
| | Gets end iterator.
|
| |
| std::string | className () const override |
| | Gets class name.
|
| |
| std::string | toString (bool enter) const override |
| | Converts to string representation.
|
| |
| | ~treeMap () override |
| | Destructor.
|
| |
| iterAdaptor | begin () |
| | Returns an iterator adapter pointing to the beginning of the container.
|
| |
| iterAdaptor | begin () const |
| | Returns a const iterator adapter pointing to the beginning of the container.
|
| |
| iterAdaptor | end () |
| | Returns an iterator adapter pointing to the end sentinel of the container.
|
| |
| iterAdaptor | end () const |
| | Returns a const iterator adapter pointing to the end sentinel of the container.
|
| |
| iterAdaptor | first () |
| | Returns an iterator adapter pointing to the first element.
|
| |
| iterAdaptor | first () const |
| | Returns a const iterator adapter pointing to the first element.
|
| |
| iterAdaptor | last () |
| | Returns an iterator adapter pointing to the last element.
|
| |
| iterAdaptor | last () const |
| | Returns a const iterator adapter pointing to the last element.
|
| |
| void | forEach (Callback operation=Callback{}) |
| | Applies a given operation to each element in the iterable container.
|
| |
| void | forEach (const Callback &operation=Callback{}) const |
| | Applies a given operation to each element in the iterable container (const version).
|
| |
|
auto | forEach (Callback operation) -> void |
| |
|
auto | forEach (const Callback &operation) const -> void |
| |
| | operator std::string () const |
| | Explicit conversion to std::string.
|
| |
| | operator const char * () const |
| | Explicit conversion to C-style string.
|
| |
| const char * | toCString (bool enter) const |
| | Direct C-string access with formatting control.
|
| |
|
template<typename TYPE > |
| auto | formatString (const TYPE &t) -> std::string |
| |
|
template<typename TYPE > |
| auto | formatCString (const TYPE &t) -> const char * |
| |
|
template<typename TYPE > |
| auto | formatEnum (const TYPE &t) -> std::string |
| |
|
template<typename TYPE > |
| auto | formatString (TYPE *const &ptr) -> std::string |
| |
|
| template<typename TYPE > |
| static std::string | formatString (const TYPE &t) |
| | Universal value-to-string conversion.
|
| |
| template<Printable TYPE> |
| static std::string | formatString (const TYPE &t) |
| | Specialization for printable types.
|
| |
| template<EnumType TYPE> |
| static std::string | formatString (const TYPE &t) |
| | Specialization for enum types.
|
| |
| template<typename TYPE > |
| static std::string | formatString (TYPE *const &ptr) |
| | Pointer-specific formatting.
|
| |
| template<typename TYPE > |
| static const char * | formatCString (const TYPE &t) |
| | C-string cache for temporary usage.
|
| |
| template<typename TYPE > |
| static std::string | formatEnum (const TYPE &t) |
| | Enum formatting utility.
|
| |
|
template<> |
| auto | formatString (const char &t) -> std::string |
| |
|
template<> |
| auto | formatString (const bool &t) -> std::string |
| |
|
template<> |
| auto | formatString (const char *const &ptr) -> std::string |
| |
template<typename K_TYPE, typename V_TYPE, typename Compare = increaseComparator<K_TYPE>, typename ALLOC = allocator<couple<const K_TYPE, V_TYPE>>>
class original::treeMap< K_TYPE, V_TYPE, Compare, ALLOC >
Red-Black Tree based implementation of the map interface.
- Template Parameters
-
| K_TYPE | Key type (must be comparable) |
| V_TYPE | Value type |
| Compare | Comparison function type (default: increaseComparator<K_TYPE>) |
| ALLOC | Allocator type (default: allocator) |
This class provides a concrete implementation of the map interface using a Red-Black Tree. It combines the functionality of:
- map (interface)
- RBTree (storage)
- iterable (iteration support)
Performance Characteristics:
- Insertion: O(log n)
- Lookup: O(log n)
- Deletion: O(log n)
- Traversal: O(n)
The implementation guarantees:
- Elements sorted by key according to comparator
- Unique keys (no duplicates)
- Type safety
- Exception safety (basic guarantee)
- Iterator validity unless modified