Home | Libraries | People | FAQ | More |
boost::itl::set — Addable, subractable and intersectable sets.
template<typename DomainT , ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT), ITL_ALLOC Alloc = std::allocator> class set { public: // types typedef itl::set< DomainT, Compare, Alloc > type; typedef ITL_IMPL_SPACE::set< DomainT, ITL_COMPARE_DOMAIN(Compare, DomainT), Alloc< DomainT > > base_type; typedef DomainT domain_type; typedef DomainT codomain_type; typedef DomainT element_type; typedef DomainT key_type; typedef DomainT value_type; typedef DomainT data_type; typedef Alloc< DomainT > allocator_type; typedef base_type::pointer pointer; typedef base_type::const_pointer const_pointer; typedef base_type::reference reference; typedef base_type::const_reference const_reference; typedef base_type::iterator iterator; typedef base_type::const_iterator const_iterator; typedef base_type::size_type size_type; typedef base_type::difference_type difference_type; typedef base_type::reverse_iterator reverse_iterator; typedef base_type::const_reverse_iterator const_reverse_iterator; // construct/copy/destruct set(); set(const domain_compare &); template<class InputIterator > set(InputIterator, InputIterator); template<class InputIterator > set(InputIterator, InputIterator, const key_compare &); set(const set &); set(const element_type &); set& operator=(const set &); // public member functions typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ; typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ; typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ; void swap(set &) ; template<class Predicate > set & assign_if(const set &, const Predicate &) ; bool contains(const element_type &) const; bool contained_in(const set &) const; bool contains(const set &) const; bool is_disjoint(const set &) const; size_t iterative_size() const; size_t cardinality() const; set & add(const element_type &) ; iterator add(iterator, const element_type &) ; set & subtract(const element_type &) ; template<class Predicate > set & erase_if(const Predicate &) ; void add_intersection(set &, const element_type &) const; void add_intersection(set &, const set &) const; bool intersects(const element_type &) const; set & flip(const element_type &) ; std::string as_string(const char * = " ") const; // public static functions template<typename IteratorT > static const key_type & key_value(IteratorT) ; template<typename IteratorT > static const data_type & data_value(IteratorT) ; template<typename LeftIterT , typename RightIterT > static bool key_less(LeftIterT, RightIterT) ; static value_type make_element(const key_type &, const data_type &) ; };
set
public
construct/copy/destructset();
set(const domain_compare & comp);
template<class InputIterator > set(InputIterator first, InputIterator past);
template<class InputIterator > set(InputIterator first, InputIterator past, const key_compare & comp);
set(const set & src);
set(const element_type & key);
set& operator=(const set & src);
set
public member functionstypedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
void swap(set & src) ;
template<class Predicate > set & assign_if(const set & src, const Predicate &) ;
Copy the elements in set src
to which property hasProperty
applies into *this
set.
bool contains(const element_type & value) const;
value
bool contained_in(const set & super) const;
Is *this
contained in super
?
bool contains(const set & sub) const;
Does *this
contain sub
?
bool is_disjoint(const set & x2) const;
*this
and x2
are disjoint, if their intersection is empty
size_t iterative_size() const;
iterative_size()
yields the number of elements that is visited throu complete iteration. For interval sets iterative_size()
is different from size()
.
size_t cardinality() const;
set & add(const element_type & element) ;
Add an element
to the set.
iterator add(iterator prior, const element_type & element) ;
Add an element element
after prior
to the set.
set & subtract(const element_type & element) ;
Subtract an element
from the set.
template<class Predicate > set & erase_if(const Predicate &) ;
Erase the elements in *this set to which property hasProperty
applies. Keep all the rest.
void add_intersection(set & section, const element_type & element) const;
Add element
to section
, if element
is in *this
set
void add_intersection(set & section, const set & sectant) const;
The intersection of set sectant
with *this
set is added to section
.
bool intersects(const element_type & element) const;
Returns true, if there is an intersection of element
and *this
set. Functions intersects
and contains
are identical on arguments of type element_type
. Complexity: Logarithmic in container size.
set & flip(const element_type & element) ;
If *this
set contains element
it is erased, otherwise it is added.
std::string as_string(const char * sep = " ") const;
Represent this set as a string
set
public static functionstemplate<typename IteratorT > static const key_type & key_value(IteratorT value_) ;
key_value
allows for a uniform access to key_values
which is is used for common algorithms on sets and maps.
template<typename IteratorT > static const data_type & data_value(IteratorT value_) ;
data_value
allows for a uniform access to data_values
which is is used for common algorithms on sets and maps.
template<typename LeftIterT , typename RightIterT > static bool key_less(LeftIterT lhs_, RightIterT rhs_) ;
key_less
allows for a uniform notation of key comparison which is used for common algorithms on sets and maps.
static value_type make_element(const key_type & key_val, const data_type &) ;
make_element
allows for a uniform notation of key comparison which is used for common algorithms on sets and maps.