Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template map

boost::itl::map — Addable, subractable and intersectable maps.

Synopsis

template<typename DomainT , typename CodomainT , 
         class Traits  = itl::partial_absorber, 
         ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT), 
         ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT), 
         ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inplace_et, CodomainT), 
         ITL_ALLOC Alloc = std::allocator> 
class map {
public:
  // types
  typedef Alloc< typename std::pair< const DomainT, CodomainT > >                                         allocator_type;            
  typedef itl::map< DomainT, CodomainT, Traits, Compare, Combine, Section, Alloc >                        type;                      
  typedef ITL_IMPL_SPACE::map< DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare, DomainT), allocator_type > base_type;                 
  typedef itl::set< DomainT, Compare, Alloc >                                                             set_type;                  
  typedef Traits                                                                                          traits;                    
  typedef DomainT                                                                                         domain_type;               
  typedef DomainT                                                                                         key_type;                  
  typedef CodomainT                                                                                       codomain_type;             
  typedef CodomainT                                                                                       mapped_type;               
  typedef CodomainT                                                                                       data_type;                 
  typedef std::pair< const DomainT, CodomainT >                                                           element_type;              
  typedef std::pair< const DomainT, CodomainT >                                                           value_type;                
  typedef domain_compare                                                                                  key_compare;               
  typedef inverse< codomain_combine >::type                                                               inverse_codomain_combine;  
  typedef inverse< codomain_intersect >::type                                                             inverse_codomain_intersect;
  typedef base_type::value_compare                                                                        value_compare;             
  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
  map();
  map(const key_compare &);
  template<class InputIterator > map(InputIterator, InputIterator);
  template<class InputIterator > 
    map(InputIterator, InputIterator, const key_compare &);
  map(const map &);
  map(const element_type &);
  map& operator=(const map &);

  // public member functions
  typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
  typedef ITL_COMBINE_CODOMAIN(Combine, CodomainT) ;
  typedef ITL_SECTION_CODOMAIN(Section, CodomainT) ;
  void swap(map &) ;
  bool contains(const domain_type &) const;
  bool contains(const element_type &) const;
  bool contained_in(const map &) const;
  bool contains(const map &) const;
  size_t iterative_size() const;
  size_t cardinality() const;
  codomain_type operator()(const domain_type &) const;
  map & add(const value_type &) ;
  iterator add(iterator, const value_type &) ;
  map & subtract(const value_type &) ;
  std::pair< iterator, bool > insert(const value_type &) ;
  iterator insert(iterator, const value_type &) ;
  map & set(const element_type &) ;
  size_type erase(const element_type &) ;
  void add_intersection(map &, const domain_type &) const;
  void add_intersection(map &, const element_type &) const;
  void add_intersection(map &, const set_type &) const;
  void add_intersection(map &, const map &) const;
  bool intersects(const domain_type &) const;
  bool intersects(const element_type &) const;
  map & flip(const element_type &) ;
  void absorb_neutrons() ;
  std::string as_string() const;
  template<class Predicate > map & erase_if(const Predicate &) ;
  template<class Predicate > map & assign_if(const map &, const Predicate &) ;
  void domain(set_type &) 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 IteratorT > 
    static const codomain_type & codomain_value(IteratorT) ;
  template<typename LeftIterT , typename RightIterT > 
    static bool key_less(LeftIterT, RightIterT) ;
  static value_type make_element(const key_type &, const data_type &) ;

  // private member functions
  template<class Combiner > map & _add(const value_type &) ;
  template<class Combiner > iterator _add(iterator, const value_type &) ;
  template<class Combiner > map & _subtract(const value_type &) ;
};

Description

map public construct/copy/destruct

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

map public member functions

  1. typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
  2. typedef ITL_COMBINE_CODOMAIN(Combine, CodomainT) ;
  3. typedef ITL_SECTION_CODOMAIN(Section, CodomainT) ;
  4. void swap(map & src) ;
  5. bool contains(const domain_type & key) const;

    Checks if a key is in the map

  6. bool contains(const element_type & key_value_pair) const;

    Checks if a key-value pair is in the map

  7. bool contained_in(const map & super) const;

    Is *this contained in super?

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

    Does *this contain sub?

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

  10. size_t cardinality() const;
  11. codomain_type operator()(const domain_type & key) const;

    Total select function.

  12. map & add(const value_type & value_pair) ;

    add inserts value_pair into the map if it's key does not exist in the map. If value_pairs's key value exists in the map, it's data value is added to the data value already found in the map.

  13. iterator add(iterator prior, const value_type & value_pair) ;

    add add value_pair into the map using prior as a hint to insert value_pair after the position prior is pointing to.

  14. map & subtract(const value_type & value_pair) ;

    If the value_pair's key value is in the map, it's data value is subtraced from the data value stored in the map.

  15. std::pair< iterator, bool > insert(const value_type & value_pair) ;
  16. iterator insert(iterator prior, const value_type & value_pair) ;
  17. map & set(const element_type & key_value_pair) ;

    With key_value_pair = (k,v) set value v for key k

  18. size_type erase(const element_type & key_value_pair) ;

    erase key_value_pair from the map. Erase only if, the exact value content val is stored for the given key.

  19. void add_intersection(map & section, const domain_type & key_value) const;

    The intersection of key in *this map is added to section.

  20. void add_intersection(map & section, const element_type & key_value_pair) const;

    The intersection of key_value_pair and *this map is added to section.

  21. void add_intersection(map & section, const set_type & sectant) const;

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

  22. void add_intersection(map & section, const map & sectant) const;

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

  23. bool intersects(const domain_type & key) const;

    Returns true, if there is an intersection of key and *this map. Functions intersects and contains are identical on key value arguments of type domain_type. Complexity: Logarithmic in container size.

  24. bool intersects(const element_type & key_value_pair) const;

    Returns true, if there is an intersection of and *this map. If the key is found, the content of key_value_pair has to have an intersection with the content of the data value in the map. Complexity: Logarithmic in container size.

  25. map & flip(const element_type & key_value_pair) ;
  26. void absorb_neutrons() ;
  27. std::string as_string() const;

    Represent this map as string

  28. template<class Predicate > map & erase_if(const Predicate &) ;

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

  29. template<class Predicate > 
      map & assign_if(const map & src, const Predicate &) ;

    Copy the elements in map src to which property hasProperty applies into *this map.

  30. void domain(set_type & domain_set) const;

    Copy the key values of the map to domain_set. Complexity: Linear.

map 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 IteratorT > 
      static const codomain_type & codomain_value(IteratorT value_) ;

    codomain_value allows for a uniform access to codomain_values which is is used for common algorithms on sets and maps.

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

  5. static value_type 
    make_element(const key_type & key_val, const data_type & data_val) ;

    iterative_size() yields the number of elements that is visited throu complete iteration. For interval sets iterative_size() is different from size().

map private member functions

  1. template<class Combiner > map & _add(const value_type & value_pair) ;
  2. template<class Combiner > 
      iterator _add(iterator prior, const value_type & value_pair) ;
  3. template<class Combiner > map & _subtract(const value_type & value_pair) ;

PrevUpHomeNext