home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / stl / wrappers / _set.h < prev    next >
C/C++ Source or Header  |  2001-11-14  |  5KB  |  142 lines

  1. /*
  2.  * Copyright (c) 1999, 2000
  3.  * Boris Fomitchev
  4.  *
  5.  * This material is provided "as is", with absolutely no warranty expressed
  6.  * or implied. Any use is at your own risk.
  7.  *
  8.  * Permission to use or copy this software for any purpose is hereby granted 
  9.  * without fee, provided the above notices are retained on all copies.
  10.  * Permission to modify the code and to distribute modified code is granted,
  11.  * provided the above notices are retained, and a notice that the code was
  12.  * modified is included with the above copyright notice.
  13.  *
  14.  */
  15.  
  16. /* NOTE: This is an internal header file, included by other STL headers.
  17.  *   You should not attempt to use it directly.
  18.  */
  19.  
  20. #ifndef _STLP_INTERNAL_WRAP_SET_H
  21. #define _STLP_INTERNAL_WRAP_SET_H
  22.  
  23. #ifndef _STLP_INTERNAL_SET_H
  24. # include <stl/_set.h>
  25. #endif
  26.  
  27. # ifdef _STLP_USE_NAMESPACES
  28. namespace STLPORT { 
  29. # endif
  30.  
  31. #  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
  32. #   define __SET_TEMPLATE_HEADER  template <class _Key>
  33. #   define __SET_ARGUMENTS        _Key
  34. #   define __MSET_TEMPLATE_HEADER  template <class _Key>
  35. #   define __MSET_ARGUMENTS        _Key
  36. #   define _Compare less<_Key>
  37. #  else
  38. #   define __SET_TEMPLATE_HEADER  template <class _Key, class _Compare >
  39. #   define __SET_ARGUMENTS        _Key, _Compare
  40. #   define __MSET_TEMPLATE_HEADER  template <class _Key, class _Compare >
  41. #   define __MSET_ARGUMENTS        _Key, _Compare
  42. #  endif
  43.  
  44. #   define __SET_SUPER  __set< _Key, _Compare, _STLP_DEFAULT_ALLOCATOR(_Key) >
  45. #   define __MSET_SUPER __multiset< _Key, _Compare, _STLP_DEFAULT_ALLOCATOR(_Key) >
  46.  
  47. // provide a "default" set adaptor
  48. __SET_TEMPLATE_HEADER
  49. class set : public __SET_SUPER
  50. {
  51.   typedef set< __SET_ARGUMENTS > _Self;
  52. public:
  53.     typedef __SET_SUPER _Super;
  54.     __IMPORT_WITH_REVERSE_ITERATORS(_Super)
  55.     // copy & assignment from super
  56.     __IMPORT_SUPER_COPY_ASSIGNMENT(set,_Self,__SET_SUPER)
  57.     // specific constructors
  58.     explicit set() : __SET_SUPER(_Compare()) {}
  59.     explicit set(const _Compare& __comp) : __SET_SUPER(__comp) {}
  60.     set(const value_type* __first, const value_type* __last) : 
  61.         __SET_SUPER(__first, __last, _Compare()) { }
  62.     set(const value_type* __first, const value_type* __last, 
  63.         const _Compare& __comp) : __SET_SUPER(__first, __last, __comp) { }
  64.     set(const_iterator __first, const_iterator __last) : 
  65.         __SET_SUPER(__first, __last, _Compare()) { }
  66.     set(const_iterator __first, const_iterator __last, 
  67.         const _Compare& __comp) : __SET_SUPER(__first, __last, __comp) { }
  68. };
  69.  
  70. #  if defined (_STLP_BASE_MATCH_BUG)
  71. __SET_TEMPLATE_HEADER 
  72. inline bool operator==(const set< __SET_ARGUMENTS >& __x, 
  73.                        const set< __SET_ARGUMENTS >& __y) {
  74.   typedef __SET_SUPER _Super;
  75.   return operator==((const _Super&)__x,(const _Super&)__y);
  76. }
  77.  
  78. __SET_TEMPLATE_HEADER 
  79. inline bool operator<(const set< __SET_ARGUMENTS >& __x, 
  80.                       const set< __SET_ARGUMENTS >& __y) {
  81.   typedef __SET_SUPER _Super;
  82.   return operator < ((const _Super&)__x , (const _Super&)__y);
  83. }
  84. #  endif
  85.  
  86. // provide a "default" multiset adaptor
  87. __MSET_TEMPLATE_HEADER 
  88. class multiset : public __MSET_SUPER
  89. {
  90.     typedef multiset< __MSET_ARGUMENTS > _Self;
  91. public:
  92.     typedef __MSET_SUPER _Super;
  93.     __IMPORT_WITH_REVERSE_ITERATORS(_Super)
  94.     // copy & assignment from super
  95.     __IMPORT_SUPER_COPY_ASSIGNMENT(multiset, _Self, __MSET_SUPER)
  96.     explicit multiset() : __MSET_SUPER(_Compare()) {}
  97.     explicit multiset(const _Compare& __comp) : __MSET_SUPER(__comp) {}
  98.     multiset(const value_type* __first, const value_type* __last) : 
  99.         __MSET_SUPER(__first, __last, _Compare()) { }
  100.     multiset(const value_type* __first, const value_type* __last, 
  101.         const _Compare& __comp) : __MSET_SUPER(__first, __last, __comp) { }
  102.     multiset(const_iterator __first, const_iterator __last) : 
  103.         __MSET_SUPER(__first, __last, _Compare()) { }
  104.     multiset(const_iterator __first, const_iterator __last, 
  105.         const _Compare& __comp) : __MSET_SUPER(__first, __last, __comp) { }
  106. };
  107.  
  108. #  if defined (_STLP_BASE_MATCH_BUG)   
  109. __MSET_TEMPLATE_HEADER 
  110. inline bool operator==(const multiset< __MSET_ARGUMENTS >& __x, 
  111.                        const multiset< __MSET_ARGUMENTS >& __y) {
  112.   typedef __MSET_SUPER  _Super;
  113.   return (const _Super&)__x == (const _Super&)__y;
  114. }
  115.  
  116. __MSET_TEMPLATE_HEADER 
  117. inline bool operator<(const multiset< __MSET_ARGUMENTS >& __x, 
  118.                       const multiset< __MSET_ARGUMENTS >& __y) {
  119.   typedef __MSET_SUPER _Super;
  120.   return (const _Super&)__x < (const _Super&)__y;
  121. }
  122. #  endif
  123.  
  124. # undef __MSET_TEMPLATE_HEADER
  125. # undef __MSET_ARGUMENTS
  126. # undef __MSET_SUPER
  127.  
  128. # undef __SET_TEMPLATE_HEADER
  129. # undef __SET_ARGUMENTS
  130. # undef __SET_SUPER 
  131. # undef _Compare
  132.  
  133. # ifdef _STLP_USE_NAMESPACES
  134. } /* namespace STLPORT */
  135. # endif
  136.  
  137. #endif /* _STLP_INTERNAL_WRAP_SET_H */
  138.  
  139. // Local Variables:
  140. // mode:C++
  141. // End:
  142.