ORIGINAL
|
Abstract base class for unique element containers. More...
#include <set.h>
Public Member Functions | |
virtual bool | add (const K_TYPE &e)=0 |
Adds a new element to the set. | |
virtual bool | remove (const K_TYPE &e)=0 |
Removes an element from the set. | |
~set () override | |
Destructor implementation. | |
![]() | |
virtual u_integer | size () const =0 |
Gets the number of elements in the container. | |
bool | empty () const |
Checks if the container is empty. | |
virtual bool | contains (const TYPE &e) const =0 |
Checks if an element is contained in the container. | |
virtual | ~container ()=default |
Destructor for the container class. | |
Protected Member Functions | |
set (ALLOC alloc=ALLOC{}) | |
Constructor implementation. | |
![]() | |
container (ALLOC alloc=ALLOC{}) | |
Constructs a container with specified allocator. | |
TYPE * | allocate (u_integer size) |
Allocates raw memory for elements. | |
void | deallocate (TYPE *ptr, u_integer size) |
Deallocates memory previously allocated by allocate() | |
template<typename O_TYPE , typename... Args> | |
void | construct (O_TYPE *o_ptr, Args &&... args) |
Constructs an element in-place. | |
template<typename O_TYPE > | |
void | destroy (O_TYPE *o_ptr) |
Destroys an element. | |
Additional Inherited Members | |
![]() | |
ALLOC | allocator |
The allocator instance used for memory management. | |
Abstract base class for unique element containers.
K_TYPE | The element type (must support equality comparison) |
ALLOC | Allocator type for memory management (default: allocator) |
This abstract class defines the common interface for all set implementations in the framework. Concrete implementations should inherit from this class and provide the actual storage mechanism.
The set guarantees:
|
explicitprotected |
Constructor implementation.
K_TYPE | The element type |
ALLOC | The allocator type |
alloc | Allocator to use for memory management |
Initializes the base container with the provided allocator
|
overridedefault |
Destructor implementation.
K_TYPE | The element type |
ALLOC | The allocator type |
Default implementation allows proper destruction through base pointer
Adds a new element to the set.
e | The element to add |
Removes an element from the set.
e | The element to remove |