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

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Configs/TI_DSP_BIOS/stl/stl_set.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,1997
    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_SET_H
    00032 #define __SGI_STL_INTERNAL_SET_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 set {
    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 set
    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   set() : _M_t(_Compare(), allocator_type()) {}
    00076   explicit set(const _Compare& __comp,
    00077                const allocator_type& __a = allocator_type())
    00078     : _M_t(__comp, __a) {}
    00079
    00080 #ifdef __STL_MEMBER_TEMPLATES
    00081   template <class _InputIterator>
    00082   set(_InputIterator __first, _InputIterator __last)
    00083     : _M_t(_Compare(), allocator_type())
    00084     { _M_t.insert_unique(__first, __last); }
    00085
    00086   template <class _InputIterator>
    00087   set(_InputIterator __first, _InputIterator __last, const _Compare& __comp,
    00088       const allocator_type& __a = allocator_type())
    00089     : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
    00090 #else
    00091   set(const value_type* __first, const value_type* __last)
    00092     : _M_t(_Compare(), allocator_type())
    00093     { _M_t.insert_unique(__first, __last); }
    00094
    00095   set(const value_type* __first,
    00096       const value_type* __last, const _Compare& __comp,
    00097       const allocator_type& __a = allocator_type())
    00098     : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
    00099
    00100   set(const_iterator __first, const_iterator __last)
    00101     : _M_t(_Compare(), allocator_type())
    00102     { _M_t.insert_unique(__first, __last); }
    00103
    00104   set(const_iterator __first, const_iterator __last, const _Compare& __comp,
    00105       const allocator_type& __a = allocator_type())
    00106     : _M_t(__comp, __a) { _M_t.insert_unique(__first, __last); }
    00107 #endif /* __STL_MEMBER_TEMPLATES */
    00108
    00109   set(const set<_Key,_Compare,_Alloc>& __x) : _M_t(__x._M_t) {}
    00110   set<_Key,_Compare,_Alloc>& operator=(const set<_Key, _Compare, _Alloc>& __x)
    00111   {
    00112     _M_t = __x._M_t;
    00113     return *this;
    00114   }
    00115
    00116   // accessors:
    00117
    00118   key_compare key_comp() const { return _M_t.key_comp(); }
    00119   value_compare value_comp() const { return _M_t.key_comp(); }
    00120   allocator_type get_allocator() const { return _M_t.get_allocator(); }
    00121
    00122   iterator begin() const { return _M_t.begin(); }
    00123   iterator end() const { return _M_t.end(); }
    00124   reverse_iterator rbegin() const { return _M_t.rbegin(); }
    00125   reverse_iterator rend() const { return _M_t.rend(); }
    00126   bool empty() const { return _M_t.empty(); }
    00127   size_type size() const { return _M_t.size(); }
    00128   size_type max_size() const { return _M_t.max_size(); }
    00129   void swap(set<_Key,_Compare,_Alloc>& __x) { _M_t.swap(__x._M_t); }
    00130
    00131   // insert/erase
    00132   pair<iterator,bool> insert(const value_type& __x) {
    00133     pair<typename _Rep_type::iterator, bool> __p = _M_t.insert_unique(__x);
    00134     return pair<iterator, bool>(__p.first, __p.second);
    00135   }
    00136   iterator insert(iterator __position, const value_type& __x) {
    00137     typedef typename _Rep_type::iterator _Rep_iterator;
    00138     return _M_t.insert_unique((_Rep_iterator&)__position, __x);
    00139   }
    00140 #ifdef __STL_MEMBER_TEMPLATES
    00141   template <class _InputIterator>
    00142   void insert(_InputIterator __first, _InputIterator __last) {
    00143     _M_t.insert_unique(__first, __last);
    00144   }
    00145 #else
    00146   void insert(const_iterator __first, const_iterator __last) {
    00147     _M_t.insert_unique(__first, __last);
    00148   }
    00149   void insert(const value_type* __first, const value_type* __last) {
    00150     _M_t.insert_unique(__first, __last);
    00151   }
    00152 #endif /* __STL_MEMBER_TEMPLATES */
    00153   void erase(iterator __position) {
    00154     typedef typename _Rep_type::iterator _Rep_iterator;
    00155     _M_t.erase((_Rep_iterator&)__position);
    00156   }
    00157   size_type erase(const key_type& __x) {
    00158     return _M_t.erase(__x);
    00159   }
    00160   void erase(iterator __first, iterator __last) {
    00161     typedef typename _Rep_type::iterator _Rep_iterator;
    00162     _M_t.erase((_Rep_iterator&)__first, (_Rep_iterator&)__last);
    00163   }
    00164   void clear() { _M_t.clear(); }
    00165
    00166   // set operations:
    00167
    00168   iterator find(const key_type& __x) const { return _M_t.find(__x); }
    00169   size_type count(const key_type& __x) const { return _M_t.count(__x); }
    00170   iterator lower_bound(const key_type& __x) const {
    00171     return _M_t.lower_bound(__x);
    00172   }
    00173   iterator upper_bound(const key_type& __x) const {
    00174     return _M_t.upper_bound(__x);
    00175   }
    00176   pair<iterator,iterator> equal_range(const key_type& __x) const {
    00177     return _M_t.equal_range(__x);
    00178   }
    00179   friend bool operator== __STL_NULL_TMPL_ARGS (const set&, const set&);
    00180   friend bool operator< __STL_NULL_TMPL_ARGS (const set&, const set&);
    00181 };
    00182
    00183 template <class _Key, class _Compare, class _Alloc>
    00184 inline bool operator==(const set<_Key,_Compare,_Alloc>& __x,
    00185                        const set<_Key,_Compare,_Alloc>& __y) {
    00186   return __x._M_t == __y._M_t;
    00187 }
    00188
    00189 template <class _Key, class _Compare, class _Alloc>
    00190 inline bool operator<(const set<_Key,_Compare,_Alloc>& __x,
    00191                       const set<_Key,_Compare,_Alloc>& __y) {
    00192   return __x._M_t < __y._M_t;
    00193 }
    00194
    00195 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
    00196
    00197 template <class _Key, class _Compare, class _Alloc>
    00198 inline void swap(set<_Key,_Compare,_Alloc>& __x,
    00199                  set<_Key,_Compare,_Alloc>& __y) {
    00200   __x.swap(__y);
    00201 }
    00202
    00203 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
    00204
    00205 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
    00206 #pragma reset woff 1174
    00207 #pragma reset woff 1375
    00208 #endif
    00209
    00210 __STL_END_NAMESPACE
    00211
    00212 #endif /* __SGI_STL_INTERNAL_SET_H */
    00213
    00214 // Local Variables:
    00215 // mode:C++
    00216 // End: