⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stl_multimap.h

📁 gcc3.2.1源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
   *                    pair should be inserted.   *  @param  x  Pair to be inserted (see std::make_pair for easy creation of   *             pairs).   *  @return An iterator that points to the inserted (key,value) pair.   *   *  This function inserts a (key, value) pair into the multimap.  Contrary   *  to a std::map the multimap does not rely on unique keys and thus a   *  multiple pairs with the same key can be inserted.   *  Note that the first parameter is only a hint and can potentially   *  improve the performance of the insertion process.  A bad hint would   *  cause no gains in efficiency.  */  iterator insert(iterator __position, const value_type& __x) {    return _M_t.insert_equal(__position, __x);  }  /**   *  @brief A template function that attemps to insert elements from   *         another range (possibly another multimap or standard container).   *  @param  first  Iterator pointing to the start of the range to be   *                 inserted.   *  @param  last  Iterator pointing to the end of the range to be inserted.  */  template <class _InputIterator>  void insert(_InputIterator __first, _InputIterator __last) {    _M_t.insert_equal(__first, __last);  }  /**   *  @brief Erases an element from a multimap.   *  @param  position  An iterator pointing to the element to be erased.   *   *  This function erases an element, pointed to by the given iterator, from   *  a mutlimap.  Note that this function only erases the element, and that   *  if the element is itself a pointer, the pointed-to memory is not   *  touched in any way.  Managing the pointer is the user's responsibilty.  */  void erase(iterator __position) { _M_t.erase(__position); }  /**   *  @brief Erases an element according to the provided key.   *  @param  x  Key of element to be erased.   *  @return  Doc me! (Number of elements erased?)   *   *  This function erases all elements, located by the given key, from a   *  multimap.   *  Note that this function only erases the element, and that if   *  the element is itself a pointer, the pointed-to memory is not touched   *  in any way.  Managing the pointer is the user's responsibilty.  */  size_type erase(const key_type& __x) { return _M_t.erase(__x); }  /**   *  @brief Erases a [first,last) range of elements from a multimap.   *  @param  first  Iterator pointing to the start of the range to be erased.   *  @param  last  Iterator pointing to the end of the range to be erased.   *   *  This function erases a sequence of elements from a multimap.   *  Note that this function only erases the elements, and that if   *  the elements themselves are pointers, the pointed-to memory is not   *  touched in any way.  Managing the pointer is the user's responsibilty.  */  void erase(iterator __first, iterator __last)    { _M_t.erase(__first, __last); }  /** Erases all elements in a multimap.  Note that this function only erases   *  the elements, and that if the elements themselves are pointers, the   *  pointed-to memory is not touched in any way.  Managing the pointer is   *  the user's responsibilty.  */  void clear() { _M_t.clear(); }  // multimap operations:  /**   *  @brief Tries to locate an element in a multimap.   *  @param  x  Key of (key, value) pair to be located.   *  @return  Iterator pointing to sought-after (first matching?) element,   *           or end() if not found.   *   *  This function takes a key and tries to locate the element with which   *  the key matches.  If successful the function returns an iterator   *  pointing to the sought after pair. If unsuccessful it returns the   *  one past the end ( end() ) iterator.  */  iterator find(const key_type& __x) { return _M_t.find(__x); }  /**   *  @brief Tries to locate an element in a multimap.   *  @param  x  Key of (key, value) pair to be located.   *  @return  Read-only (constant) iterator pointing to sought-after (first   *           matching?) element, or end() if not found.   *   *  This function takes a key and tries to locate the element with which   *  the key matches.  If successful the function returns a constant iterator   *  pointing to the sought after pair. If unsuccessful it returns the   *  one past the end ( end() ) iterator.  */  const_iterator find(const key_type& __x) const { return _M_t.find(__x); }  /**   *  @brief Finds the number of elements with given key.   *  @param  x  Key of (key, value) pairs to be located.   *  @return Number of elements with specified key.  */  size_type count(const key_type& __x) const { return _M_t.count(__x); }  /**   *  @brief Finds the beginning of a subsequence matching given key.   *  @param  x  Key of (key, value) pair to be located.   *  @return  Iterator pointing to first element matching given key, or   *           end() if not found.   *   *  This function returns the first element of a subsequence of elements   *  that matches the given key.  If unsuccessful it returns an iterator   *  pointing to the first element that has a greater value than given key   *  or end() if no such element exists.  */  iterator lower_bound(const key_type& __x) {return _M_t.lower_bound(__x); }  /**   *  @brief Finds the beginning of a subsequence matching given key.   *  @param  x  Key of (key, value) pair to be located.   *  @return  Read-only (constant) iterator pointing to first element   *           matching given key, or end() if not found.   *   *  This function returns the first element of a subsequence of elements   *  that matches the given key.  If unsuccessful the iterator will point   *  to the next greatest element or, if no such greater element exists, to   *  end().  */  const_iterator lower_bound(const key_type& __x) const {    return _M_t.lower_bound(__x);  }  /**   *  @brief Finds the end of a subsequence matching given key.   *  @param  x  Key of (key, value) pair to be located.   *  @return Iterator pointing to last element matching given key.  */  iterator upper_bound(const key_type& __x) {return _M_t.upper_bound(__x); }  /**   *  @brief Finds the end of a subsequence matching given key.   *  @param  x  Key of (key, value) pair to be located.   *  @return  Read-only (constant) iterator pointing to last element matching   *           given key.  */  const_iterator upper_bound(const key_type& __x) const {    return _M_t.upper_bound(__x);  }  /**   *  @brief Finds a subsequence matching given key.   *  @param  x  Key of (key, value) pairs to be located.   *  @return  Pair of iterators that possibly points to the subsequence   *           matching given key.   *   *  This function improves on lower_bound() and upper_bound() by giving a more   *  elegant and efficient solution.  It returns a pair of which the first   *  element possibly points to the first element matching the given key   *  and the second element possibly points to the last element matching the   *  given key.  If unsuccessful the first element of the returned pair will   *  contain an iterator pointing to the next greatest element or, if no such   *  greater element exists, to end().  */  pair<iterator,iterator> equal_range(const key_type& __x) {    return _M_t.equal_range(__x);  }  /**   *  @brief Finds a subsequence matching given key.   *  @param  x  Key of (key, value) pairs to be located.   *  @return  Pair of read-only (constant) iterators that possibly points to   *           the subsequence matching given key.   *   *  This function improves on lower_bound() and upper_bound() by giving a more   *  elegant and efficient solution.  It returns a pair of which the first   *  element possibly points to the first element matching the given key   *  and the second element possibly points to the last element matching the   *  given key.  If unsuccessful the first element of the returned pair will   *  contain an iterator pointing to the next greatest element or, if no such   *  a greater element exists, to end().  */  pair<const_iterator,const_iterator> equal_range(const key_type& __x) const {    return _M_t.equal_range(__x);  }  template <class _K1, class _T1, class _C1, class _A1>  friend bool operator== (const multimap<_K1, _T1, _C1, _A1>&,                          const multimap<_K1, _T1, _C1, _A1>&);  template <class _K1, class _T1, class _C1, class _A1>  friend bool operator< (const multimap<_K1, _T1, _C1, _A1>&,                         const multimap<_K1, _T1, _C1, _A1>&);};template <class _Key, class _Tp, class _Compare, class _Alloc>inline bool operator==(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,                       const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {  return __x._M_t == __y._M_t;}template <class _Key, class _Tp, class _Compare, class _Alloc>inline bool operator<(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,                       const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {  return __x._M_t < __y._M_t;}template <class _Key, class _Tp, class _Compare, class _Alloc>inline bool operator!=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,                        const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {  return !(__x == __y);}template <class _Key, class _Tp, class _Compare, class _Alloc>inline bool operator>(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,                       const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {  return __y < __x;}template <class _Key, class _Tp, class _Compare, class _Alloc>inline bool operator<=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,                        const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {  return !(__y < __x);}template <class _Key, class _Tp, class _Compare, class _Alloc>inline bool operator>=(const multimap<_Key,_Tp,_Compare,_Alloc>& __x,                        const multimap<_Key,_Tp,_Compare,_Alloc>& __y) {  return !(__x < __y);}template <class _Key, class _Tp, class _Compare, class _Alloc>inline void swap(multimap<_Key,_Tp,_Compare,_Alloc>& __x,                  multimap<_Key,_Tp,_Compare,_Alloc>& __y) {  __x.swap(__y);}} // namespace std#endif /* __GLIBCPP_INTERNAL_MULTIMAP_H */// Local Variables:// mode:C++// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -