Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Class template map

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

Synopsis

// In header: <boost/icl/map.hpp>

template<typename DomainT, typename CodomainT, 
         typename Traits = icl::partial_absorber, 
         ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT), 
         ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT), 
         ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT), 
         ICL_ALLOC Alloc = std::allocator> 
class map {
public:
  // types
  typedef Alloc< typename std::pair< const DomainT, CodomainT > >                                                          allocator_type;            
  typedef icl::map< DomainT, CodomainT, Traits, Compare, Combine, Section, Alloc >                                         type;                      
  typedef ICL_IMPL_SPACE::map< DomainT, CodomainT, ICL_COMPARE_DOMAIN(Compare, DomainT), allocator_type >                  base_type;                 
  typedef Traits                                                                                                           traits;                    
  typedef DomainT                                                                                                          domain_type;               
  typedef boost::call_traits< DomainT >::param_type                                                                        domain_param;              
  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 mpl::if_< has_set_semantics< codomain_type >, ICL_SECTION_CODOMAIN(Section, CodomainT), codomain_combine >::type codomain_intersect;        
  typedef inverse< codomain_intersect >::type                                                                              inverse_codomain_intersect;
  typedef base_type::value_compare                                                                                         value_compare;             
  typedef ICL_IMPL_SPACE::set< DomainT, domain_compare, Alloc< DomainT > >                                                 set_type;                  
  typedef set_type                                                                                                         key_object_type;           
  typedef on_absorbtion< type, codomain_combine, Traits::absorbs_identities >                                              on_identity_absorbtion;    
  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;    

  // member classes/structs/unions
  template<typename Type> 
  struct on_codomain_model<Type, false, false> {

    // public static functions
    static void subtract(Type &, typename Type::iterator, 
                         const typename Type::codomain_type &);
  };
  template<typename Type> 
  struct on_codomain_model<Type, false, true> {

    // public static functions
    static void subtract(Type &, typename Type::iterator, 
                         const typename Type::codomain_type &);
  };
  template<typename Type> 
  struct on_codomain_model<Type, true, false> {
    // types
    typedef Type::inverse_codomain_intersect inverse_codomain_intersect;

    // public static functions
    static void subtract(Type &, typename Type::iterator, 
                         const typename Type::codomain_type &);
  };
  template<typename Type> 
  struct on_codomain_model<Type, true, true> {
    // types
    typedef Type::inverse_codomain_intersect inverse_codomain_intersect;

    // public static functions
    static void subtract(Type &, typename Type::iterator, 
                         const typename Type::codomain_type &);
  };
  template<typename Type> 
  struct on_definedness<Type, false> {

    // public static functions
    static void add_intersection(Type &, const Type &, const element_type &);
  };
  template<typename Type> 
  struct on_definedness<Type, true> {

    // public static functions
    static void add_intersection(Type &, const Type &, const element_type &);
  };
  template<typename Type> 
  struct on_invertible<Type, false> {
    // types
    typedef Type::element_type             element_type;            
    typedef Type::inverse_codomain_combine inverse_codomain_combine;

    // public static functions
    static void subtract(Type &, const element_type &);
  };
  template<typename Type> 
  struct on_invertible<Type, true> {
    // types
    typedef Type::element_type             element_type;            
    typedef Type::inverse_codomain_combine inverse_codomain_combine;

    // public static functions
    static void subtract(Type &, const element_type &);
  };
  template<typename Type> 
  struct on_total_absorbable<Type, false, false> {
    // types
    typedef Type::element_type               element_type;              
    typedef Type::codomain_type              codomain_type;             
    typedef Type::iterator                   iterator;                  
    typedef Type::inverse_codomain_intersect inverse_codomain_intersect;

    // public static functions
    static void flip(Type &, const element_type &);
  };
  template<typename Type> 
  struct on_total_absorbable<Type, false, true> {
    // types
    typedef Type::element_type               element_type;              
    typedef Type::codomain_type              codomain_type;             
    typedef Type::iterator                   iterator;                  
    typedef Type::inverse_codomain_intersect inverse_codomain_intersect;

    // public static functions
    static void flip(Type &, const element_type &);
  };
  template<typename Type> 
  struct on_total_absorbable<Type, true, false> {
    // types
    typedef Type::element_type  element_type; 
    typedef Type::codomain_type codomain_type;

    // public static functions
    static void flip(Type &, const element_type &);
  };
  template<typename Type> 
  struct on_total_absorbable<Type, true, true> {
    // types
    typedef Type::element_type element_type;

    // public static functions
    static void flip(Type &, const typename Type::element_type &);
  };

  // construct/copy/destruct
  map();
  map(const key_compare &);
  template<typename InputIterator> map(InputIterator, InputIterator);
  template<typename InputIterator> 
    map(InputIterator, InputIterator, const key_compare &);
  map(const map &);
  explicit map(const element_type &);
  map(map &&);
  map& operator=(const map &);
  map& operator=(map &&);

  // public member functions
  typedef ICL_COMPARE_DOMAIN(Compare, DomainT);
  typedef ICL_COMBINE_CODOMAIN(Combine, CodomainT);
  typedef ICL_COMPARE_DOMAIN(Compare, element_type);
   BOOST_STATIC_CONSTANT(bool, _total = (Traits::is_total));
   BOOST_STATIC_CONSTANT(bool, _absorbs = (Traits::absorbs_identities));
   BOOST_STATIC_CONSTANT(bool, 
                         total_invertible = (mpl::and_< is_total< type >, has_inverse< codomain_type > >::value));
   BOOST_STATIC_CONSTANT(bool, 
                         is_total_invertible = (Traits::is_total &&has_inverse< codomain_type >::value));
   BOOST_STATIC_CONSTANT(int, fineness = 4);
  void swap(map &);
  template<typename SubObject> bool contains(const SubObject &) const;
  bool within(const map &) const;
  std::size_t iterative_size() const;
  codomain_type operator()(const domain_type &) const;
  map & add(const value_type &);
  iterator add(iterator, const value_type &);
  map & subtract(const element_type &);
  map & subtract(const domain_type &);
  std::pair< iterator, bool > insert(const value_type &);
  iterator insert(iterator, const value_type &);
  template<typename Iterator> iterator insert(Iterator, Iterator);
  map & set(const element_type &);
  size_type erase(const element_type &);
  void add_intersection(map &, const element_type &) const;
  map & flip(const element_type &);
  template<typename Combiner> 
    map< DomainT, CodomainT, Traits, Compare, Combine, Section, Alloc >::iterator 
    _add(iterator, const value_type &);
  template<typename Combiner> 
    map< DomainT, CodomainT, Traits, Compare, Combine, Section, Alloc > & 
    _subtract(const value_type &);

  // private member functions
  template<typename Combiner> map & _add(const element_type &);
  template<typename Combiner> iterator _add(iterator, const element_type &);
  template<typename Combiner> map & _subtract(const element_type &);
  template<typename FragmentT> 
    void total_add_intersection(type &, const FragmentT &) const;
  void partial_add_intersection(type &, const element_type &) const;
};

Description

map public construct/copy/destruct

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

map public member functions

  1. typedef ICL_COMPARE_DOMAIN(Compare, DomainT);
  2. typedef ICL_COMBINE_CODOMAIN(Combine, CodomainT);
  3. typedef ICL_COMPARE_DOMAIN(Compare, element_type);
  4.  BOOST_STATIC_CONSTANT(bool, _total = (Traits::is_total));
  5.  BOOST_STATIC_CONSTANT(bool, _absorbs = (Traits::absorbs_identities));
  6.  BOOST_STATIC_CONSTANT(bool, 
                           total_invertible = (mpl::and_< is_total< type >, has_inverse< codomain_type > >::value));
  7.  BOOST_STATIC_CONSTANT(bool, 
                           is_total_invertible = (Traits::is_total &&has_inverse< codomain_type >::value));
  8.  BOOST_STATIC_CONSTANT(int, fineness = 4);
  9. void swap(map & src);
  10. template<typename SubObject> bool contains(const SubObject & sub) const;
  11. bool within(const map & super) const;
  12. std::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().

  13. codomain_type operator()(const domain_type & key) const;

    Total select function.

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

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

  16. map & subtract(const element_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.

  17. map & subtract(const domain_type & key);
  18. std::pair< iterator, bool > insert(const value_type & value_pair);
  19. iterator insert(iterator prior, const value_type & value_pair);
  20. template<typename Iterator> iterator insert(Iterator first, Iterator last);
  21. map & set(const element_type & key_value_pair);

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

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

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

  24. map & flip(const element_type & operand);
  25. template<typename Combiner> 
      map< DomainT, CodomainT, Traits, Compare, Combine, Section, Alloc >::iterator 
      _add(iterator prior_, const value_type & addend);
  26. template<typename Combiner> 
      map< DomainT, CodomainT, Traits, Compare, Combine, Section, Alloc > & 
      _subtract(const value_type & minuend);

map private member functions

  1. template<typename Combiner> map & _add(const element_type & value_pair);
  2. template<typename Combiner> 
      iterator _add(iterator prior, const element_type & value_pair);
  3. template<typename Combiner> map & _subtract(const element_type & value_pair);
  4. template<typename FragmentT> 
      void total_add_intersection(type & section, const FragmentT & fragment) const;
  5. void partial_add_intersection(type & section, const element_type & operand) const;

PrevUpHomeNext