_set.h

00001 /*
00002  * Copyright (c) 1999, 2000
00003  * Boris Fomitchev
00004  *
00005  * This material is provided "as is", with absolutely no warranty expressed
00006  * or implied. Any use is at your own risk.
00007  *
00008  * Permission to use or copy this software for any purpose is hereby granted 
00009  * without fee, provided the above notices are retained on all copies.
00010  * Permission to modify the code and to distribute modified code is granted,
00011  * provided the above notices are retained, and a notice that the code was
00012  * modified is included with the above copyright notice.
00013  *
00014  */
00015 
00016 /* NOTE: This is an internal header file, included by other STL headers.
00017  *   You should not attempt to use it directly.
00018  */
00019 
00020 #ifndef _STLP_INTERNAL_WRAP_SET_H
00021 #define _STLP_INTERNAL_WRAP_SET_H
00022 
00023 #ifndef _STLP_INTERNAL_SET_H
00024 # include <stl/_set.h>
00025 #endif
00026 
00027 # ifdef _STLP_USE_NAMESPACES
00028 namespace STLPORT { 
00029 # endif
00030 
00031 #  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
00032 #   define __SET_TEMPLATE_HEADER  template <class _Key>
00033 #   define __SET_ARGUMENTS        _Key
00034 #   define __MSET_TEMPLATE_HEADER  template <class _Key>
00035 #   define __MSET_ARGUMENTS        _Key
00036 #   define _Compare less<_Key>
00037 #  else
00038 #   define __SET_TEMPLATE_HEADER  template <class _Key, class _Compare >
00039 #   define __SET_ARGUMENTS        _Key, _Compare
00040 #   define __MSET_TEMPLATE_HEADER  template <class _Key, class _Compare >
00041 #   define __MSET_ARGUMENTS        _Key, _Compare
00042 #  endif
00043 
00044 #   define __SET_SUPER  __set< _Key, _Compare, _STLP_DEFAULT_ALLOCATOR(_Key) >
00045 #   define __MSET_SUPER __multiset< _Key, _Compare, _STLP_DEFAULT_ALLOCATOR(_Key) >
00046 
00047 // provide a "default" set adaptor
00048 __SET_TEMPLATE_HEADER
00049 class set : public __SET_SUPER
00050 {
00051   typedef set< __SET_ARGUMENTS > _Self;
00052 public:
00053     typedef __SET_SUPER _Super;
00054     __IMPORT_WITH_REVERSE_ITERATORS(_Super)
00055     // copy & assignment from super
00056     __IMPORT_SUPER_COPY_ASSIGNMENT(set,_Self,__SET_SUPER)
00057     // specific constructors
00058     explicit set() : __SET_SUPER(_Compare()) {}
00059     explicit set(const _Compare& __comp) : __SET_SUPER(__comp) {}
00060     set(const value_type* __first, const value_type* __last) : 
00061         __SET_SUPER(__first, __last, _Compare()) { }
00062     set(const value_type* __first, const value_type* __last, 
00063         const _Compare& __comp) : __SET_SUPER(__first, __last, __comp) { }
00064     set(const_iterator __first, const_iterator __last) : 
00065         __SET_SUPER(__first, __last, _Compare()) { }
00066     set(const_iterator __first, const_iterator __last, 
00067         const _Compare& __comp) : __SET_SUPER(__first, __last, __comp) { }
00068 };
00069 
00070 #  if defined (_STLP_BASE_MATCH_BUG)
00071 __SET_TEMPLATE_HEADER 
00072 inline bool operator==(const set< __SET_ARGUMENTS >& __x, 
00073                        const set< __SET_ARGUMENTS >& __y) {
00074   typedef __SET_SUPER _Super;
00075   return operator==((const _Super&)__x,(const _Super&)__y);
00076 }
00077 
00078 __SET_TEMPLATE_HEADER 
00079 inline bool operator<(const set< __SET_ARGUMENTS >& __x, 
00080                       const set< __SET_ARGUMENTS >& __y) {
00081   typedef __SET_SUPER _Super;
00082   return operator < ((const _Super&)__x , (const _Super&)__y);
00083 }
00084 #  endif
00085 
00086 // provide a "default" multiset adaptor
00087 __MSET_TEMPLATE_HEADER 
00088 class multiset : public __MSET_SUPER
00089 {
00090     typedef multiset< __MSET_ARGUMENTS > _Self;
00091 public:
00092     typedef __MSET_SUPER _Super;
00093     __IMPORT_WITH_REVERSE_ITERATORS(_Super)
00094     // copy & assignment from super
00095     __IMPORT_SUPER_COPY_ASSIGNMENT(multiset, _Self, __MSET_SUPER)
00096     explicit multiset() : __MSET_SUPER(_Compare()) {}
00097     explicit multiset(const _Compare& __comp) : __MSET_SUPER(__comp) {}
00098     multiset(const value_type* __first, const value_type* __last) : 
00099         __MSET_SUPER(__first, __last, _Compare()) { }
00100     multiset(const value_type* __first, const value_type* __last, 
00101         const _Compare& __comp) : __MSET_SUPER(__first, __last, __comp) { }
00102     multiset(const_iterator __first, const_iterator __last) : 
00103         __MSET_SUPER(__first, __last, _Compare()) { }
00104     multiset(const_iterator __first, const_iterator __last, 
00105         const _Compare& __comp) : __MSET_SUPER(__first, __last, __comp) { }
00106 };
00107 
00108 #  if defined (_STLP_BASE_MATCH_BUG)   
00109 __MSET_TEMPLATE_HEADER 
00110 inline bool operator==(const multiset< __MSET_ARGUMENTS >& __x, 
00111                        const multiset< __MSET_ARGUMENTS >& __y) {
00112   typedef __MSET_SUPER  _Super;
00113   return (const _Super&)__x == (const _Super&)__y;
00114 }
00115 
00116 __MSET_TEMPLATE_HEADER 
00117 inline bool operator<(const multiset< __MSET_ARGUMENTS >& __x, 
00118                       const multiset< __MSET_ARGUMENTS >& __y) {
00119   typedef __MSET_SUPER _Super;
00120   return (const _Super&)__x < (const _Super&)__y;
00121 }
00122 #  endif
00123 
00124 # undef __MSET_TEMPLATE_HEADER
00125 # undef __MSET_ARGUMENTS
00126 # undef __MSET_SUPER
00127 
00128 # undef __SET_TEMPLATE_HEADER
00129 # undef __SET_ARGUMENTS
00130 # undef __SET_SUPER 
00131 # undef _Compare
00132 
00133 # ifdef _STLP_USE_NAMESPACES
00134 } /* namespace STLPORT */
00135 # endif
00136 
00137 #endif /* _STLP_INTERNAL_WRAP_SET_H */
00138 
00139 // Local Variables:
00140 // mode:C++
00141 // End:

Generated on Mon Jun 5 10:20:47 2006 for Intelligence.kdevelop by  doxygen 1.4.6