Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template set

boost::itl::set — Addable, subractable and intersectable sets.

Synopsis

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 &) ;
};

Description

set public construct/copy/destruct

  1. set();
  2. set(const domain_compare & comp);
  3. template<class InputIterator > set(InputIterator first, InputIterator past);
  4. template<class InputIterator > 
      set(InputIterator first, InputIterator past, const key_compare & comp);
  5. set(const set & src);
  6. set(const element_type & key);
  7. set& operator=(const set & src);

set public member functions

  1. typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
  2. typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
  3. typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
  4. void swap(set & src) ;
  5. 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.

  6. bool contains(const element_type & value) const;
    value
  7. bool contained_in(const set & super) const;

    Is *this contained in super?

  8. bool contains(const set & sub) const;

    Does *this contain sub?

  9. bool is_disjoint(const set & x2) const;

    *this and x2 are disjoint, if their intersection is empty

  10. 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().

  11. size_t cardinality() const;
  12. set & add(const element_type & element) ;

    Add an element to the set.

  13. iterator add(iterator prior, const element_type & element) ;

    Add an element element after prior to the set.

  14. set & subtract(const element_type & element) ;

    Subtract an element from the set.

  15. template<class Predicate > set & erase_if(const Predicate &) ;

    Erase the elements in *this set to which property hasProperty applies. Keep all the rest.

  16. void add_intersection(set & section, const element_type & element) const;

    Add element to section, if element is in *this set

  17. void add_intersection(set & section, const set & sectant) const;

    The intersection of set sectant with *this set is added to section.

  18. 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.

  19. set & flip(const element_type & element) ;

    If *this set contains element it is erased, otherwise it is added.

  20. std::string as_string(const char * sep = " ") const;

    Represent this set as a string

set public static functions

  1. template<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.

  2. 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.

  3. 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.

  4. 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.


PrevUpHomeNext