A set of integers. More...
#include <IntSetSparse.h>
Public Types | |
typedef base_type::iterator | iterator |
An element iterator. | |
typedef base_type::const_iterator | const_iterator |
A const iterator on the elements. | |
typedef base_type::value_type | value_type |
The value type. | |
typedef int | size_type |
The size type. | |
Public Member Functions | |
Constructors etc. | |
IntSetSparse () | |
Default constructor. Empty set. | |
IntSetSparse (const value_type upper_bound) | |
Construct from the element upper bound. | |
template<typename IntInIter > | |
IntSetSparse (IntInIter start, IntInIter finish, const value_type upper_bound) | |
Construct from the element upper bound and a range of elements. | |
IntSetSparse (const IntSetSparse &x) | |
Copy constructor. | |
IntSetSparse & | operator= (const IntSetSparse &x) |
Assignment operator. | |
~IntSetSparse () | |
Destructor. | |
Accessors. | |
value_type | upper_bound () const |
Return the upper bound on the elements. | |
size_type | size () const |
Return the number of elements. | |
bool | empty () const |
Return true if the size() is zero. | |
const_iterator | begin () const |
Return a const iterator to the first element. | |
const_iterator | end () const |
Return a const iterator to one past the last element. | |
bool | is_in (const value_type x) const |
Return true if x is in the set. | |
bool | subset (const IntSetSparse &x) const |
Return true if x is a subset of this set. | |
bool | is_valid () const |
Return true if the set is valid. | |
Manipulators. | |
iterator | begin () |
Return an iterator to the first element. | |
iterator | end () |
Return an iterator to one past the last element. | |
void | set_upper_bound (const value_type upper_bound) |
Set the upper bound. | |
std::pair< iterator, bool > | insert (const value_type x) |
Insert an element. | |
iterator | insert (const iterator position, const value_type x) |
Insert an element using the position as a hint to where it will be inserted. | |
template<typename IntInIter > | |
void | insert (IntInIter start, IntInIter finish) |
Insert a range of elements. | |
std::insert_iterator < IntSetSparse > | inserter () |
Return an insert iterator. | |
void | erase (const iterator i) |
Erase the element to which i points. | |
bool | erase (const value_type x) |
Erase the specified element. | |
void | clear () |
Clear set. | |
void | swap (IntSetSparse &x) |
Swap with another set. | |
Equality. | |
bool | operator== (const IntSetSparse< T > &x) const |
Return true if the sets are the same. | |
bool | operator!= (const IntSetSparse &x) const |
Return true if the sets are not the same. | |
File I/O. | |
void | put (std::ostream &out) const |
Write the size and the elements. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const IntSetSparse< T > &x) |
Write the size and the elements. | |
template<typename T > | |
void | set_union (const IntSetSparse< T > &a, const IntSetSparse< T > &b, IntSetSparse< T > &c) |
Form the union of the two sets. | |
template<typename T > | |
void | set_intersection (const IntSetSparse< T > &a, const IntSetSparse< T > &b, IntSetSparse< T > &c) |
Form the intersection of the two sets. | |
template<typename T > | |
void | set_difference (const IntSetSparse< T > &a, const IntSetSparse< T > &b, IntSetSparse< T > &c) |
Form the difference of the two sets. | |
template<typename T > | |
void | set_complement (const IntSetSparse< T > &a, IntSetSparse< T > &b) |
Form the complement of the set. |
A set of integers.
void IntSetSparse< T >::insert | ( | IntInIter | start, | |
IntInIter | finish | |||
) | [inline] |
Insert a range of elements.
IntInIter
is an input iterator for the value type.
References IntSetSparse< T >::insert().
bool IntSetSparse< T >::is_valid | ( | ) | const [inline] |
Return true if the set is valid.
The elements must be in the range [ 0..upper_bound()).
References IntSetSparse< T >::begin(), IntSetSparse< T >::end(), and IntSetSparse< T >::upper_bound().
Referenced by IntSetSparse< T >::set_complement().