#include <adevs_bag.h>
Public Types | |
typedef iterator | const_iterator |
Public Member Functions | |
Bag (unsigned int cap=8) | |
Create an empty bag with an initial capacity. | |
Bag (const Bag< T > &src) | |
Copy constructor uses the = operator of T. | |
const Bag< T > & | operator= (const Bag< T > &src) |
Assignment operator uses the = operator of T. | |
unsigned | count (const T &a) const |
Count the instances of a stored in the bag. | |
unsigned | size () const |
Get the number of elements in the bag. | |
bool | empty () const |
Same as size()==0. | |
iterator | begin () const |
Get an iterator pointing to the first element in the bag. | |
iterator | end () const |
Get an iterator to the end of the bag (i.e., just after the last element). | |
void | erase (const T &k) |
Erase the first instance of k. | |
void | erase (iterator p) |
Erase the element pointed to by p. | |
void | clear () |
Remove all of the elements from the bag. | |
iterator | find (const T &k) const |
Find the first instance of k, or end() if no instance is found. Uses == for comparing T. | |
void | insert (const T &t) |
Put t into the bag. | |
Classes | |
class | iterator |
A bidirectional iterator for the Bag. More... |