KrisLibrary  1.0.0
Public Types | Public Member Functions | Public Attributes | List of all members
Subset Struct Reference

A finite subset of numbered items with convenient operators for union, intersection, difference, etc. More...

#include <Subset.h>

Public Types

typedef std::vector< int >::iterator iterator
 
typedef std::vector< int >::const_iterator const_iterator
 

Public Member Functions

 Subset (int maxItem=0)
 
 Subset (const Subset &s)
 
 Subset (const std::vector< bool > &bits)
 
std::vector< int >::iterator begin ()
 
std::vector< int >::iterator end ()
 
std::vector< int >::const_iterator begin () const
 
std::vector< int >::const_iterator end () const
 
bool empty () const
 
size_t size () const
 
bool operator< (const Subset &s) const
 
bool operator> (const Subset &s) const
 
bool operator== (const Subset &s) const
 
bool operator!= (const Subset &s) const
 
Subset operator+ (const Subset &s) const
 
Subset operator- () const
 
Subset operator- (const Subset &s) const
 
Subset operator& (const Subset &s) const
 
void insert (int item)
 
void insert_end (int item)
 
void remove (int item)
 
iterator find (int item)
 
const_iterator find (int item) const
 
void erase (iterator it)
 
size_t count (int item) const
 
bool is_subset (const Subset &s) const
 

Public Attributes

int maxItem
 
std::vector< int > items
 

Detailed Description

A finite subset of numbered items with convenient operators for union, intersection, difference, etc.

Most efficient when the subset contains far fewer items than the maximum. If a majority of items are stored, then a bit-vector may be more efficient.


The documentation for this struct was generated from the following files: