libcommonc++
0.7
|
A reference-counted set. More...
#include <RefSet.h++>
Public Member Functions | |
RefSet () | |
Construct a new RefSet. More... | |
~RefSet () | |
Destructor. More... | |
bool | add (T value) |
Add a value to the set. More... | |
bool | remove (T value) |
Remove a value from the set. More... | |
bool | contains (T value) const |
Determine if a value is present in the set. More... | |
int | refCount (T value) const |
Get the reference count for a given value. More... | |
Public Attributes | |
K | keys |
STL member. More... | |
T | elements |
STL member. More... | |
A reference-counted set.
The set allows duplicate values, but it reference counts them, so that a value must be removed the same number of times that it was added in order to actually be removed from the set. RefSet is a subclass of std::map<T, int>.
~RefSet | ( | ) |
Destructor.
bool add | ( | T | value | ) |
Add a value to the set.
If the value is already in the set, its reference count is incremented.
value | The value to add. |
bool contains | ( | T | value | ) | const |
Determine if a value is present in the set.
value | The value. |
int refCount | ( | T | value | ) | const |
Get the reference count for a given value.
value | The value. |
bool remove | ( | T | value | ) |
Remove a value from the set.
Decrements the reference count for the value, and removes the value from the set if the reference count has reached 0.
value | The value to remove. |
|
inherited |
STL member.
|
inherited |
STL member.