2 * Copyright (c) 1999, 2000
5 * This material is provided "as is", with absolutely no warranty expressed
6 * or implied. Any use is at your own risk.
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.
16 /* NOTE: This is an internal header file, included by other STL headers.
17 * You should not attempt to use it directly.
20 #ifndef _STLP_INTERNAL_WRAP_SET_H
21 #define _STLP_INTERNAL_WRAP_SET_H
23 #ifndef _STLP_INTERNAL_SET_H
24 # include <stl/_set.h>
27 # ifdef _STLP_USE_NAMESPACES
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>
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
44 # define __SET_SUPER __set< _Key, _Compare, _STLP_DEFAULT_ALLOCATOR(_Key) >
45 # define __MSET_SUPER __multiset< _Key, _Compare, _STLP_DEFAULT_ALLOCATOR(_Key) >
47 // provide a "default" set adaptor
49 class set : public __SET_SUPER
51 typedef set< __SET_ARGUMENTS > _Self;
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) { }
70 # if defined (_STLP_BASE_MATCH_BUG)
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);
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);
86 // provide a "default" multiset adaptor
87 __MSET_TEMPLATE_HEADER
88 class multiset : public __MSET_SUPER
90 typedef multiset< __MSET_ARGUMENTS > _Self;
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) { }
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;
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;
124 # undef __MSET_TEMPLATE_HEADER
125 # undef __MSET_ARGUMENTS
128 # undef __SET_TEMPLATE_HEADER
129 # undef __SET_ARGUMENTS
133 # ifdef _STLP_USE_NAMESPACES
134 } /* namespace STLPORT */
137 #endif /* _STLP_INTERNAL_WRAP_SET_H */