00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __SGI_STL_INTERNAL_MULTISET_H
00032 #define __SGI_STL_INTERNAL_MULTISET_H
00033
00034 #include <concept_checks.h>
00035
00036 __STL_BEGIN_NAMESPACE
00037
00038 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00039 #pragma set woff 1174
00040 #pragma set woff 1375
00041 #endif
00042
00043
00044
00045 template <class _Key, class _Compare __STL_DEPENDENT_DEFAULT_TMPL(less<_Key>),
00046 class _Alloc = __STL_DEFAULT_ALLOCATOR(_Key) >
00047 class multiset;
00048
00049 template <class _Key, class _Compare, class _Alloc>
00050 inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x,
00051 const multiset<_Key,_Compare,_Alloc>& __y);
00052
00053 template <class _Key, class _Compare, class _Alloc>
00054 inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
00055 const multiset<_Key,_Compare,_Alloc>& __y);
00056
00057 template <class _Key, class _Compare, class _Alloc>
00058 class multiset {
00059
00060
00061 __STL_CLASS_REQUIRES(_Key, _Assignable);
00062 __STL_CLASS_BINARY_FUNCTION_CHECK(_Compare, bool, _Key, _Key);
00063
00064 public:
00065
00066
00067
00068 typedef _Key key_type;
00069 typedef _Key value_type;
00070 typedef _Compare key_compare;
00071 typedef _Compare value_compare;
00072 private:
00073 typedef _Rb_tree<key_type, value_type,
00074 _Identity<value_type>, key_compare, _Alloc> _Rep_type;
00075 _Rep_type _M_t;
00076 public:
00077 typedef typename _Rep_type::const_pointer pointer;
00078 typedef typename _Rep_type::const_pointer const_pointer;
00079 typedef typename _Rep_type::const_reference reference;
00080 typedef typename _Rep_type::const_reference const_reference;
00081 typedef typename _Rep_type::const_iterator iterator;
00082 typedef typename _Rep_type::const_iterator const_iterator;
00083 typedef typename _Rep_type::const_reverse_iterator reverse_iterator;
00084 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
00085 typedef typename _Rep_type::size_type size_type;
00086 typedef typename _Rep_type::difference_type difference_type;
00087 typedef typename _Rep_type::allocator_type allocator_type;
00088
00089
00090
00091 multiset() : _M_t(_Compare(), allocator_type()) {}
00092 explicit multiset(const _Compare& __comp,
00093 const allocator_type& __a = allocator_type())
00094 : _M_t(__comp, __a) {}
00095
00096 #ifdef __STL_MEMBER_TEMPLATES
00097
00098 template <class _InputIterator>
00099 multiset(_InputIterator __first, _InputIterator __last)
00100 : _M_t(_Compare(), allocator_type())
00101 { _M_t.insert_equal(__first, __last); }
00102
00103 template <class _InputIterator>
00104 multiset(_InputIterator __first, _InputIterator __last,
00105 const _Compare& __comp,
00106 const allocator_type& __a = allocator_type())
00107 : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
00108
00109 #else
00110
00111 multiset(const value_type* __first, const value_type* __last)
00112 : _M_t(_Compare(), allocator_type())
00113 { _M_t.insert_equal(__first, __last); }
00114
00115 multiset(const value_type* __first, const value_type* __last,
00116 const _Compare& __comp,
00117 const allocator_type& __a = allocator_type())
00118 : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
00119
00120 multiset(const_iterator __first, const_iterator __last)
00121 : _M_t(_Compare(), allocator_type())
00122 { _M_t.insert_equal(__first, __last); }
00123
00124 multiset(const_iterator __first, const_iterator __last,
00125 const _Compare& __comp,
00126 const allocator_type& __a = allocator_type())
00127 : _M_t(__comp, __a) { _M_t.insert_equal(__first, __last); }
00128
00129 #endif
00130
00131 multiset(const multiset<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
00132 multiset<_Key,_Compare,_Alloc>&
00133 operator=(const multiset<_Key,_Compare,_Alloc>& __x) {
00134 _M_t = __x._M_t;
00135 return *this;
00136 }
00137
00138
00139
00140 key_compare key_comp() const { return _M_t.key_comp(); }
00141 value_compare value_comp() const { return _M_t.key_comp(); }
00142 allocator_type get_allocator() const { return _M_t.get_allocator(); }
00143
00144 iterator begin() const { return _M_t.begin(); }
00145 iterator end() const { return _M_t.end(); }
00146 reverse_iterator rbegin() const { return _M_t.rbegin(); }
00147 reverse_iterator rend() const { return _M_t.rend(); }
00148 bool empty() const { return _M_t.empty(); }
00149 size_type size() const { return _M_t.size(); }
00150 size_type max_size() const { return _M_t.max_size(); }
00151 void swap(multiset<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
00152
00153
00154 iterator insert(const value_type& __x) {
00155 return _M_t.insert_equal(__x);
00156 }
00157 iterator insert(iterator __position, const value_type& __x) {
00158 typedef typename _Rep_type::iterator _Rep_iterator;
00159 return _M_t.insert_equal((_Rep_iterator&)__position, __x);
00160 }
00161
00162 #ifdef __STL_MEMBER_TEMPLATES
00163 template <class _InputIterator>
00164 void insert(_InputIterator __first, _InputIterator __last) {
00165 _M_t.insert_equal(__first, __last);
00166 }
00167 #else
00168 void insert(const value_type* __first, const value_type* __last) {
00169 _M_t.insert_equal(__first, __last);
00170 }
00171 void insert(const_iterator __first, const_iterator __last) {
00172 _M_t.insert_equal(__first, __last);
00173 }
00174 #endif
00175 void erase(iterator __position) {
00176 typedef typename _Rep_type::iterator _Rep_iterator;
00177 _M_t.erase((_Rep_iterator&)__position);
00178 }
00179 size_type erase(const key_type& __x) {
00180 return _M_t.erase(__x);
00181 }
00182 void erase(iterator __first, iterator __last) {
00183 typedef typename _Rep_type::iterator _Rep_iterator;
00184 _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
00185 }
00186 void clear() { _M_t.clear(); }
00187
00188
00189
00190 iterator find(const key_type& __x) const { return _M_t.find(__x); }
00191 size_type count(const key_type& __x) const { return _M_t.count(__x); }
00192 iterator lower_bound(const key_type& __x) const {
00193 return _M_t.lower_bound(__x);
00194 }
00195 iterator upper_bound(const key_type& __x) const {
00196 return _M_t.upper_bound(__x);
00197 }
00198 pair<iterator,iterator> equal_range(const key_type& __x) const {
00199 return _M_t.equal_range(__x);
00200 }
00201
00202 #ifdef __STL_TEMPLATE_FRIENDS
00203 template <class _K1, class _C1, class _A1>
00204 friend bool operator== (const multiset<_K1,_C1,_A1>&,
00205 const multiset<_K1,_C1,_A1>&);
00206 template <class _K1, class _C1, class _A1>
00207 friend bool operator< (const multiset<_K1,_C1,_A1>&,
00208 const multiset<_K1,_C1,_A1>&);
00209 #else
00210 friend bool __STD_QUALIFIER
00211 operator== __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
00212 friend bool __STD_QUALIFIER
00213 operator< __STL_NULL_TMPL_ARGS (const multiset&, const multiset&);
00214 #endif
00215 };
00216
00217 template <class _Key, class _Compare, class _Alloc>
00218 inline bool operator==(const multiset<_Key,_Compare,_Alloc>& __x,
00219 const multiset<_Key,_Compare,_Alloc>& __y) {
00220 return __x._M_t == __y._M_t;
00221 }
00222
00223 template <class _Key, class _Compare, class _Alloc>
00224 inline bool operator<(const multiset<_Key,_Compare,_Alloc>& __x,
00225 const multiset<_Key,_Compare,_Alloc>& __y) {
00226 return __x._M_t < __y._M_t;
00227 }
00228
00229 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
00230
00231 template <class _Key, class _Compare, class _Alloc>
00232 inline bool operator!=(const multiset<_Key,_Compare,_Alloc>& __x,
00233 const multiset<_Key,_Compare,_Alloc>& __y) {
00234 return !(__x == __y);
00235 }
00236
00237 template <class _Key, class _Compare, class _Alloc>
00238 inline bool operator>(const multiset<_Key,_Compare,_Alloc>& __x,
00239 const multiset<_Key,_Compare,_Alloc>& __y) {
00240 return __y < __x;
00241 }
00242
00243 template <class _Key, class _Compare, class _Alloc>
00244 inline bool operator<=(const multiset<_Key,_Compare,_Alloc>& __x,
00245 const multiset<_Key,_Compare,_Alloc>& __y) {
00246 return !(__y < __x);
00247 }
00248
00249 template <class _Key, class _Compare, class _Alloc>
00250 inline bool operator>=(const multiset<_Key,_Compare,_Alloc>& __x,
00251 const multiset<_Key,_Compare,_Alloc>& __y) {
00252 return !(__x < __y);
00253 }
00254
00255 template <class _Key, class _Compare, class _Alloc>
00256 inline void swap(multiset<_Key,_Compare,_Alloc>& __x,
00257 multiset<_Key,_Compare,_Alloc>& __y) {
00258 __x.swap(__y);
00259 }
00260
00261 #endif
00262
00263 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00264 #pragma reset woff 1174
00265 #pragma reset woff 1375
00266 #endif
00267
00268 __STL_END_NAMESPACE
00269
00270 #endif
00271
00272
00273
00274