|
virtual |
it adds an object with a weight to this collection.
What happens if:
if the new weight is positive, the weight of the object is changed. if it becomes negative, the corresponding object is removed from the collection.
It is added to the collection even if the weight is negative. In this case, it is assumed as a mistake and the stored weight is the absolute value.
Because this class used std::vector, you should avoid adding/removing objects too often like in a loop.
Definition at line 49 of file RandObj.cpp.