Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Class template map

Boost , Chapter 1. Boost.Icl , Header <boost/icl/map.hpp>

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

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 : private ICL_IMPL_SPACE::map< DomainT, CodomainT, ICL_COMPARE_DOMAIN(Compare, DomainT), Alloc< std::pair< const DomainT, CodomainT > > >
{
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, bool has_set_semantics, bool absorbs_identities> 
  struct on_codomain_model {
  };
  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, bool is_total> 
  struct on_definedness {
  };
  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, bool is_total_invertible> 
  struct on_invertible {
  };
  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, bool is_total, bool absorbs_identities> 
  struct on_total_absorbable {
  };
  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=(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 > & 
    _add(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(constkey_compare&comp);
    >
  3. <
    template<typenameInputIterator>map(InputIteratorfirst,InputIteratorpast);
    >
  4. <
    template<typenameInputIterator>
     map(InputIteratorfirst,InputIteratorpast,constkey_compare&comp);
    >
  5. <
    map(constmap&src);
    >
  6. <
    explicitmap(constelement_type&key_value_pair);
    >
  7. <
    map(map&&src);
    >
  8. <
    map&operator=(mapsrc);
    >

map public member functions

  1. <
    typedefICL_COMPARE_DOMAIN(Compare,DomainT);
    >
  2. <
    typedefICL_COMBINE_CODOMAIN(Combine,CodomainT);
    >
  3. <
    typedefICL_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. <
    voidswap(map&src);
    >
  10. <
    template<typenameSubObject>boolcontains(constSubObject&sub)const;
    >
  11. <
    boolwithin(constmap&super)const;
    >
  12. <
    std::size_titerative_size()const;
    >

    <iterative_size()>дает число элементов, которые посещаются после полной итерации. Для интервальных наборов<iterative_size()>отличается от<size()>

    .
  13. <
    codomain_typeoperator()(constdomain_type&key)const;
    >

    Полная функция выбора.

  14. <
    map&add(constvalue_type&value_pair);
    >

    <add>вставляет<value_pair>в карту, если на карте нет ключа. Если<value_pairs's>ключевое значение существует на карте, его значение данных добавляется к значению данных, уже найденному на карте.

  15. <
    iteratoradd(iteratorprior,constvalue_type&value_pair);
    >

    <add>добавить<value_pair>в карту, используя<prior>в качестве подсказки для вставки<value_pair>после того, как положение<prior>указывает на.

  16. <
    map&subtract(constelement_type&value_pair);
    >

    Если ключевое значение<value_pair's>находится на карте, его значение данных вычитается из значения данных, хранящегося на карте.

  17. <
    map&subtract(constdomain_type&key);
    >
  18. <
    std::pair<iterator,bool>insert(constvalue_type&value_pair);
    >
  19. <
    iteratorinsert(iteratorprior,constvalue_type&value_pair);
    >
  20. <
    template<typenameIterator>iteratorinsert(Iteratorfirst,Iteratorlast);
    >
  21. <
    map&set(constelement_type&key_value_pair);
    >

    С<key_value_pair = (k,v)>заданным значением<v>для ключа<k>

  22. <
    size_typeerase(constelement_type&key_value_pair);
    >

    стереть<key_value_pair>с карты. Стирается только в том случае, если для данного ключа сохраняется точное значение содержимого<val>.

  23. <
    voidadd_intersection(map&section,constelement_type&key_value_pair)const;
    >

    Пересечение<key_value_pair>и<*this>карты добавлено к<section>

    .
  24. <
    map&flip(constelement_type&operand);
    >
  25. <
    template<typenameCombiner>
     map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>&
     _add(constelement_type&addend);
    >
  26. <
    template<typenameCombiner>
     map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>::iterator
     _add(iteratorprior_,constvalue_type&addend);
    >
  27. <
    template<typenameCombiner>
     map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>&
     _subtract(constvalue_type&minuend);
    >

map private member functions

  1. <
    template<typenameCombiner>map&_add(constelement_type&value_pair);
    >
  2. <
    template<typenameCombiner>
     iterator_add(iteratorprior,constelement_type&value_pair);
    >
  3. <
    template<typenameCombiner>map&_subtract(constelement_type&value_pair);
    >
  4. <
    template<typenameFragmentT>
     voidtotal_add_intersection(type&section,constFragmentT&fragment)const;
    >
  5. <
    voidpartial_add_intersection(type&section,constelement_type&operand)const;
    >

PrevUpHomeNext

Статья Class template map раздела Chapter 1. Boost.Icl Header <boost/icl/map.hpp> может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Header <boost/icl/map.hpp> ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-19 23:35:03/0.011975049972534/1