Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4680 | right-hear | 1 | /* |
2 | * Copyright (c) 1999 |
||
3 | * Silicon Graphics Computer Systems, Inc. |
||
4 | * |
||
5 | * Permission to use, copy, modify, distribute and sell this software |
||
6 | * and its documentation for any purpose is hereby granted without fee, |
||
7 | * provided that the above copyright notice appear in all copies and |
||
8 | * that both that copyright notice and this permission notice appear |
||
9 | * in supporting documentation. Silicon Graphics makes no |
||
10 | * representations about the suitability of this software for any |
||
11 | * purpose. It is provided "as is" without express or implied warranty. |
||
12 | */ |
||
13 | |||
14 | #ifndef _STL_SEQUENCE_CONCEPTS_H |
||
15 | #define _STL_SEQUENCE_CONCEPTS_H 1 |
||
16 | |||
17 | #pragma GCC system_header |
||
18 | |||
19 | #include |
||
20 | |||
21 | #ifdef __STL_USE_CONCEPT_CHECKS |
||
22 | |||
23 | // This file covers the following concepts: |
||
24 | // _Sequence |
||
25 | // _FrontInsertionSequence |
||
26 | // _BackInsertionSequence |
||
27 | |||
28 | struct _ERROR_IN_STL_SEQ { |
||
29 | |||
30 | template |
||
31 | static void |
||
32 | __fill_constructor_requirement_violation(_XX& __s) { |
||
33 | typename _XX::value_type __t = typename _XX::value_type(); |
||
34 | typename _XX::difference_type __n = typename _XX::difference_type(); |
||
35 | _XX __x(__n, __t); |
||
36 | __sink_unused_warning(__x); |
||
37 | } |
||
38 | template |
||
39 | static void |
||
40 | __fill_default_constructor_requirement_violation(_XX& __s) { |
||
41 | _STL_ERROR::__default_constructor_requirement_violation(*__s.begin()); |
||
42 | typename _XX::difference_type __n = typename _XX::difference_type(); |
||
43 | _XX __x(__n); |
||
44 | __sink_unused_warning(__x); |
||
45 | } |
||
46 | template |
||
47 | static void |
||
48 | __range_constructor_requirement_violation(_XX& __s) { |
||
49 | _XX __x(__s.begin(), __s.end()); |
||
50 | __sink_unused_warning(__x); |
||
51 | } |
||
52 | template |
||
53 | static void |
||
54 | __insert_function_requirement_violation(_XX& __s) { |
||
55 | typename _XX::value_type __t = typename _XX::value_type(); |
||
56 | typename _XX::iterator __p = typename _XX::iterator(); |
||
57 | __p = __s.insert(__p, __t); |
||
58 | } |
||
59 | template |
||
60 | static void |
||
61 | __fill_insert_function_requirement_violation(_XX& __s) { |
||
62 | typename _XX::value_type __t = typename _XX::value_type(); |
||
63 | typename _XX::iterator __p = typename _XX::iterator(); |
||
64 | typename _XX::difference_type __n = typename _XX::difference_type(); |
||
65 | __s.insert(__p, __n, __t); |
||
66 | } |
||
67 | template |
||
68 | static void |
||
69 | __range_insert_function_requirement_violation(_XX& __s) { |
||
70 | typename _XX::iterator __p = typename _XX::iterator(); |
||
71 | typename _XX::iterator __i = typename _XX::iterator(); |
||
72 | typename _XX::iterator __j = typename _XX::iterator(); |
||
73 | __s.insert(__p, __i, __j); |
||
74 | } |
||
75 | template |
||
76 | static void |
||
77 | __insert_element_function_requirement_violation(_XX& __s) { |
||
78 | typename _XX::value_type __t = typename _XX::value_type(); |
||
79 | std::pair |
||
80 | __r = __s.insert(__t); |
||
81 | __sink_unused_warning(__r); |
||
82 | } |
||
83 | template |
||
84 | static void |
||
85 | __unconditional_insert_element_function_requirement_violation(_XX& __s) { |
||
86 | typename _XX::value_type __t = typename _XX::value_type(); |
||
87 | typename _XX::iterator __p; |
||
88 | __p = __s.insert(__t); |
||
89 | __sink_unused_warning(__p); |
||
90 | } |
||
91 | template |
||
92 | static void |
||
93 | __erase_function_requirement_violation(_XX& __s) { |
||
94 | typename _XX::iterator __p = typename _XX::iterator(); |
||
95 | __p = __s.erase(__p); |
||
96 | } |
||
97 | template |
||
98 | static void |
||
99 | __range_erase_function_requirement_violation(_XX& __s) { |
||
100 | typename _XX::iterator __p = typename _XX::iterator(); |
||
101 | typename _XX::iterator __q = typename _XX::iterator(); |
||
102 | __p = __s.erase(__p, __q); |
||
103 | } |
||
104 | template |
||
105 | static void |
||
106 | __const_front_function_requirement_violation(const _XX& __s) { |
||
107 | typename _XX::const_reference __t = __s.front(); |
||
108 | __sink_unused_warning(__t); |
||
109 | } |
||
110 | template |
||
111 | static void |
||
112 | __front_function_requirement_violation(_XX& __s) { |
||
113 | typename _XX::reference __t = __s.front(); |
||
114 | __const_front_function_requirement_violation(__s); |
||
115 | __sink_unused_warning(__t); |
||
116 | } |
||
117 | template |
||
118 | static void |
||
119 | __const_back_function_requirement_violation(const _XX& __s) { |
||
120 | typename _XX::const_reference __t = __s.back(); |
||
121 | __sink_unused_warning(__t); |
||
122 | } |
||
123 | template |
||
124 | static void |
||
125 | __back_function_requirement_violation(_XX& __s) { |
||
126 | typename _XX::reference __t = __s.back(); |
||
127 | __const_back_function_requirement_violation(__s); |
||
128 | __sink_unused_warning(__t); |
||
129 | } |
||
130 | template |
||
131 | static void |
||
132 | __push_front_function_requirement_violation(_XX& __s) { |
||
133 | typename _XX::value_type __t = typename _XX::value_type(); |
||
134 | __s.push_front(__t); |
||
135 | } |
||
136 | template |
||
137 | static void |
||
138 | __pop_front_function_requirement_violation(_XX& __s) { |
||
139 | __s.pop_front(); |
||
140 | } |
||
141 | template |
||
142 | static void |
||
143 | __push_back_function_requirement_violation(_XX& __s) { |
||
144 | typename _XX::value_type __t = typename _XX::value_type(); |
||
145 | __s.push_back(__t); |
||
146 | } |
||
147 | template |
||
148 | static void |
||
149 | __pop_back_function_requirement_violation(_XX& __s) { |
||
150 | __s.pop_back(); |
||
151 | } |
||
152 | |||
153 | }; |
||
154 | |||
155 | /* Sequence Containers */ |
||
156 | |||
157 | template |
||
158 | struct _Sequence_concept_specification { |
||
159 | static void |
||
160 | _Sequence_requirement_violation(_Sequence __s) { |
||
161 | // Refinement of ForwardContainer |
||
162 | _ForwardContainer_concept_specification<_Sequence>::_ForwardContainer_requirement_violation(__s); |
||
163 | // Refinement of DefaultConstructible |
||
164 | _DefaultConstructible_concept_specification<_Sequence>::_DefaultConstructible_requirement_violation(__s); |
||
165 | // Valid Expressions |
||
166 | _ERROR_IN_STL_SEQ::__fill_constructor_requirement_violation(__s); |
||
167 | _ERROR_IN_STL_SEQ::__fill_default_constructor_requirement_violation(__s); |
||
168 | _ERROR_IN_STL_SEQ::__range_constructor_requirement_violation(__s); |
||
169 | _ERROR_IN_STL_SEQ::__insert_function_requirement_violation(__s); |
||
170 | _ERROR_IN_STL_SEQ::__fill_insert_function_requirement_violation(__s); |
||
171 | _ERROR_IN_STL_SEQ::__range_insert_function_requirement_violation(__s); |
||
172 | _ERROR_IN_STL_SEQ::__erase_function_requirement_violation(__s); |
||
173 | _ERROR_IN_STL_SEQ::__range_erase_function_requirement_violation(__s); |
||
174 | _ERROR_IN_STL_SEQ::__front_function_requirement_violation(__s); |
||
175 | } |
||
176 | }; |
||
177 | |||
178 | template |
||
179 | struct _FrontInsertionSequence_concept_specification { |
||
180 | static void |
||
181 | _FrontInsertionSequence_requirement_violation(_FrontInsertionSequence __s) { |
||
182 | // Refinement of Sequence |
||
183 | _Sequence_concept_specification<_FrontInsertionSequence>::_Sequence_requirement_violation(__s); |
||
184 | // Valid Expressions |
||
185 | _ERROR_IN_STL_SEQ::__push_front_function_requirement_violation(__s); |
||
186 | _ERROR_IN_STL_SEQ::__pop_front_function_requirement_violation(__s); |
||
187 | } |
||
188 | }; |
||
189 | |||
190 | template |
||
191 | struct _BackInsertionSequence_concept_specification { |
||
192 | static void |
||
193 | _BackInsertionSequence_requirement_violation(_BackInsertionSequence __s) { |
||
194 | // Refinement of Sequence |
||
195 | _Sequence_concept_specification<_BackInsertionSequence>::_Sequence_requirement_violation(__s); |
||
196 | // Valid Expressions |
||
197 | _ERROR_IN_STL_SEQ::__back_function_requirement_violation(__s); |
||
198 | _ERROR_IN_STL_SEQ::__push_back_function_requirement_violation(__s); |
||
199 | _ERROR_IN_STL_SEQ::__pop_back_function_requirement_violation(__s); |
||
200 | } |
||
201 | }; |
||
202 | |||
203 | #endif /* if __STL_USE_CONCEPT_CHECKS */ |
||
204 | |||
205 | |||
206 | #endif /* _STL_SEQUENCE_CONCEPTS_H */ |