- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Configs/TI_DSP_BIOS/stl/stl_multiset.h

    00001 /*
    00002  *
    00003  * Copyright (c) 1994
    00004  * Hewlett-Packard Company
    00005  *
    00006  * Permission to use, copy, modify, distribute and sell this software
    00007  * and its documentation for any purpose is hereby granted without fee,
    00008  * provided that the above copyright notice appear in all copies and
    00009  * that both that copyright notice and this permission notice appear
    00010  * in supporting documentation.  Hewlett-Packard Company makes no
    00011  * representations about the suitability of this software for any
    00012  * purpose.  It is provided "as is" without express or implied warranty.
    00013  *
    00014  *
    00015  * Copyright (c) 1996
    00016  * Silicon Graphics Computer Systems, Inc.
    00017  *
    00018  * Permission to use, copy, modify, distribute and sell this software
    00019  * and its documentation for any purpose is hereby granted without fee,
    00020  * provided that the above copyright notice appear in all copies and
    00021  * that both that copyright notice and this permission notice appear
    00022  * in supporting documentation.  Silicon Graphics makes no
    00023  * representations about the suitability of this software for any
    00024  * purpose.  It is provided "as is" without express or implied warranty.
    00025  */
    00026
    00027 /* NOTE: This is an internal header file, included by other STL headers.
    00028  *   You should not attempt to use it directly.
    00029  */
    00030
    00031 #ifndef __SGI_STL_INTERNAL_MULTISET_H
    00032 #define __SGI_STL_INTERNAL_MULTISET_H
    00033
    00034 __STL_BEGIN_NAMESPACE
    00035
    00036 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
    00037 #pragma set woff 1174
    00038 #pragma set woff 1375
    00039 #endif
    00040
    00041 #ifndef __STL_LIMITED_DEFAULT_TEMPLATES
    00042 template <class _Key, class _Compare = less<_Key>,
    00043           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
    00044 #else
    00045 template <class _Key, class _Compare,
    00046           class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
    00047 #endif
    00048 class multiset {
    00049 public:
    00050   // typedefs:
    00051
    00052   typedef _Key     key_type;
    00053   typedef _Key     value_type;
    00054   typedef _Compare key_compare;
    00055   typedef _Compare value_compare;
    00056 private:
    00057   typedef _Rb_tree<key_type, value_type,
    00058                   _Identity<value_type>, key_compare, _Alloc> _Rep_type;
    00059   _Rep_type _M_t;  // red-black tree representing multiset
    00060 public:
    00061   typedef typename _Rep_type::const_pointer pointer;
    00062   typedef typename _Rep_type::const_pointer const_pointer;
    00063   typedef typename _Rep_type::const_reference reference;
    00064   typedef typename _Rep_type::const_reference const_reference;
    00065   typedef typename _Rep_type::const_iterator iterator;
    00066   typedef typename _Rep_type::const_iterator const_iterator;
    00067   typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
    00068   typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
    00069   typedef typename _Rep_type::size_type size_type;
    00070   typedef typename _Rep_type::difference_type difference_type;
    00071   typedef typename _Rep_type::allocator_type allocator_type;
    00072
    00073   // allocation/deallocation
    00074
    00075   multiset() : _M_t(_Compare(), allocator_type()) {}
    00076   explicit multiset(const _Compare& __comp,
    00077                     const allocator_type& __a = allocator_type())
    00078     : _M_t(__comp, __a) {}
    00079
    00080 #ifdef __STL_MEMBER_TEMPLATES
    00081
    00082   template <class _InputIterator>
    00083   multiset(_InputIterator __first, _InputIterator __last)
    00084     : _M_t(_Compare(), allocator_type())
    00085     { _M_t.insert_equal(__first, __last); }
    00086
    00087   template <class _InputIterator>
    00088   multiset(_InputIterator __first, _InputIterator __last,
    00089            const _Compare& __comp,
    00090            const allocator_type& __a = allocator_type())
    00091     : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
    00092
    00093 #else
    00094
    00095   multiset(const value_type* __first, const value_type* __last)
    00096     : _M_t(_Compare(), allocator_type())
    00097     { _M_t.insert_equal(__first, __last); }
    00098
    00099   multiset(const value_type* __first, const value_type* __last,
    00100            const _Compare& __comp,
    00101            const allocator_type& __a = allocator_type())
    00102     : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
    00103
    00104   multiset(const_iterator __first, const_iterator __last)
    00105     : _M_t(_Compare(), allocator_type())
    00106     { _M_t.insert_equal(__first, __last); }
    00107
    00108   multiset(const_iterator __first, const_iterator __last,
    00109            const _Compare& __comp,
    00110            const allocator_type& __a = allocator_type())
    00111     : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
    00112
    00113 #endif /* __STL_MEMBER_TEMPLATES */
    00114
    00115   multiset(const multiset<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
    00116   multiset<_Key,_Compare,_Alloc>&
    00117   operator=(const multiset<_Key,_Compare,_Alloc>& __x) {
    00118     _M_t = __x._M_t;
    00119     return *this;
    00120   }
    00121
    00122   // accessors:
    00123
    00124   key_compare key_comp() const { return _M_t.key_comp(); }
    00125   value_compare value_comp() const { return _M_t.key_comp(); }
    00126   allocator_type get_allocator() const { return _M_t.get_allocator(); }
    00127
    00128   iterator begin() const { return _M_t.begin(); }
    00129   iterator end() const { return _M_t.end(); }
    00130   reverse_iterator rbegin() const { return _M_t.rbegin(); }
    00131   reverse_iterator rend() const { return _M_t.rend(); }
    00132   bool empty() const { return _M_t.empty(); }
    00133   size_type size() const { return _M_t.size(); }
    00134   size_type max_size() const { return _M_t.max_size(); }
    00135   void swap(multiset<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
    00136
    00137   // insert/erase
    00138   iterator insert(const value_type& __x) {
    00139     return _M_t.insert_equal(__x);
    00140   }
    00141   iterator insert(iterator __position, const value_type& __x) {
    00142     typedef typename _Rep_type::iterator _Rep_iterator;
    00143     return _M_t.insert_equal((_Rep_iterator&)__position, __x);
    00144   }
    00145
    00146 #ifdef __STL_MEMBER_TEMPLATES
    00147   template <class _InputIterator>
    00148   void insert(_InputIterator __first, _InputIterator __last) {
    00149     _M_t.insert_equal(__first, __last);
    00150   }
    00151 #else
    00152   void insert(const value_type* __first, const value_type* __last) {
    00153     _M_t.insert_equal(__first, __last);
    00154   }
    00155   void insert(const_iterator __first, const_iterator __last) {
    00156     _M_t.insert_equal(__first, __last);
    00157   }
    00158 #endif /* __STL_MEMBER_TEMPLATES */
    00159   void erase(iterator __position) {
    00160     typedef typename _Rep_type::iterator _Rep_iterator;
    00161     _M_t.erase((_Rep_iterator&)__position);
    00162   }
    00163   size_type erase(const key_type& __x) {
    00164     return _M_t.erase(__x);
    00165   }
    00166   void erase(iterator __first, iterator __last) {
    00167     typedef typename _Rep_type::iterator _Rep_iterator;
    00168     _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
    00169   }
    00170   void clear() { _M_t.clear(); }
    00171
    00172   // multiset operations:
    00173
    00174   iterator find(const key_type& __x) const { return _M_t.find(__x); }
    00175   size_type count(const key_type& __x) const { return _M_t.count(__x); }
    00176   iterator lower_bound(const key_type& __x) const {
    00177     return _M_t.lower_bound(__x);
    00178   }
    00179   iterator upper_bound(const key_type& __x) const {
    00180     return _M_t.upper_bound(__x);
    00181   }
    00182   pair<iterator,iterator> equal_range(const key_type& __x) const {
    00183     return _M_t.equal_range(__x);
    00184   }
    00185   friend bool operator== __STL_NULL_TMPL_ARGS (const multiset&,
    00186                                                const multiset&);
    00187   friend bool operator< __STL_NULL_TMPL_ARGS (const multiset&,
    00188                                               const multiset&);
    00189 };
    00190
    00191 template <class _Key, class _Compare, class _Alloc>
    00192 inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x,
    00193                        const multiset<_Key,_Compare,_Alloc>& __y) {
    00194   return __x._M_t == __y._M_t;
    00195 }
    00196
    00197 template <class _Key, class _Compare, class _Alloc>
    00198 inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
    00199                       const multiset<_Key,_Compare,_Alloc>& __y) {
    00200   return __x._M_t < __y._M_t;
    00201 }
    00202
    00203 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
    00204
    00205 template <class _Key, class _Compare, class _Alloc>
    00206 inline void swap(multiset<_Key,_Compare,_Alloc>& __x,
    00207                  multiset<_Key,_Compare,_Alloc>& __y) {
    00208   __x.swap(__y);
    00209 }
    00210
    00211 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
    00212
    00213 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
    00214 #pragma reset woff 1174
    00215 #pragma reset woff 1375
    00216 #endif
    00217
    00218 __STL_END_NAMESPACE
    00219
    00220 #endif /* __SGI_STL_INTERNAL_MULTISET_H */
    00221
    00222 // Local Variables:
    00223 // mode:C++
    00224 // End: