OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libstdc++-v3/] [docs/] [html/] [17_intro/] [concept_check.diff] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 20 jlechner
 
2
Changes made while bringing boost/concept_check.hpp to v3's concept_check.h:
3
 
4
1)  File format changed from DOS to Unix.
5
2)  Boost config.hpp and other workaround files dropped (unneeded in g++ v3).
6
3)  Conditionally-compiled code depending on those "breakage" macros was
7
    removed, or not, depending on the macro, so that the macros themselves
8
    are gone.  Since the same code would always be compiled, let's make it
9
    easier on the reader and a few milliseconds faster for cpplib.
10
4)  Tests for NDEBUG were removed; if NDEBUG is defined, none of the checking
11
    code will even be included.
12
5)  BOOST_CLASS_REQUIRES* changed to accept a namespace parameter.
13
6)  SameTypeConcept added (simple wrapper around existing code).
14
7)  An unused variable in OutputIteratorConcept was removed.
15
 
16
At checkin, this was the exact diff, modulo the end-of-line character changes:
17
 
18
 
19
--- concept_check.hpp.orig      Sun Apr  1 08:59:46 2001
20
+++ boost_concept_check.h       Mon Apr  2 18:56:41 2001
21
@@ -5,20 +5,15 @@
22
 // "as is" without express or implied warranty, and with no claim as
23
 // to its suitability for any purpose.
24
 //
25
+
26
+// GCC Note:  based on version 1.12.0 of the Boost library.
27
 #ifndef BOOST_CONCEPT_CHECKS_HPP
28
 #define BOOST_CONCEPT_CHECKS_HPP
29
 
30
-#include <boost/config.hpp>
31
-#include <boost/iterator.hpp>
32
-#include <boost/iterator.hpp>
33
-#include <utility>
34
-#include <boost/pending/limits.hpp>
35
-
36
-#if (__GNUC__) || defined(__KCC) || defined(__ghs) || defined(__MWERKS__)
37
-#define BOOST_FPTR &
38
-#else
39
-#define BOOST_FPTR
40
-#endif
41
+#pragma GCC system_header
42
+#include <bits/stl_iterator_base_types.h>    // for traits and tags
43
+#include <utility>                           // for pair<>
44
+
45
 
46
 namespace boost {
47
 
48
@@ -27,80 +22,64 @@
49
 template <class Concept>
50
 void function_requires()
51
 {
52
-#if !defined(NDEBUG)
53
-  void (Concept::*x)() = BOOST_FPTR Concept::constraints;
54
+  void (Concept::*x)() = &Concept::constraints;
55
   ignore_unused_variable_warning(x);
56
-#endif
57
 }
58
 
59
-// The BOOST_CLASS_REQUIRES macros use function pointers as
60
-// template parameters, which VC++ does not support.
61
-
62
-#if defined(BOOST_NO_FUNCTION_PTR_TEMPLATE_PARAMETERS)
63
-
64
-#define BOOST_CLASS_REQUIRES(type_var, concept)
65
-#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept)
66
-#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept)
67
-#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept)
68
 
69
-#else
70
-
71
-#define BOOST_CLASS_REQUIRES(type_var, concept) \
72
-  typedef void (concept <type_var>::* func##type_var##concept)(); \
73
+#define BOOST_CLASS_REQUIRES(type_var, ns, concept) \
74
+  typedef void (ns::concept <type_var>::* func##type_var##concept)(); \
75
   template <func##type_var##concept _Tp1> \
76
   struct concept_checking_##type_var##concept { }; \
77
   typedef concept_checking_##type_var##concept< \
78
-    BOOST_FPTR concept <type_var>::constraints> \
79
+    &ns::concept <type_var>::constraints> \
80
     concept_checking_typedef_##type_var##concept
81
 
82
-#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, concept) \
83
-  typedef void (concept <type_var1,type_var2>::* func##type_var1##type_var2##concept)(); \
84
+#define BOOST_CLASS_REQUIRES2(type_var1, type_var2, ns, concept) \
85
+  typedef void (ns::concept <type_var1,type_var2>::* func##type_var1##type_var2##concept)(); \
86
   template <func##type_var1##type_var2##concept _Tp1> \
87
   struct concept_checking_##type_var1##type_var2##concept { }; \
88
   typedef concept_checking_##type_var1##type_var2##concept< \
89
-    BOOST_FPTR concept <type_var1,type_var2>::constraints> \
90
+    &ns::concept <type_var1,type_var2>::constraints> \
91
     concept_checking_typedef_##type_var1##type_var2##concept
92
 
93
-#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, concept) \
94
-  typedef void (concept <type_var1,type_var2,type_var3>::* func##type_var1##type_var2##type_var3##concept)(); \
95
+#define BOOST_CLASS_REQUIRES3(type_var1, type_var2, type_var3, ns, concept) \
96
+  typedef void (ns::concept <type_var1,type_var2,type_var3>::* func##type_var1##type_var2##type_var3##concept)(); \
97
   template <func##type_var1##type_var2##type_var3##concept _Tp1> \
98
   struct concept_checking_##type_var1##type_var2##type_var3##concept { }; \
99
   typedef concept_checking_##type_var1##type_var2##type_var3##concept< \
100
-    BOOST_FPTR concept <type_var1,type_var2,type_var3>::constraints>  \
101
+    &ns::concept <type_var1,type_var2,type_var3>::constraints>  \
102
   concept_checking_typedef_##type_var1##type_var2##type_var3##concept
103
 
104
-#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, concept) \
105
-  typedef void (concept <type_var1,type_var2,type_var3,type_var4>::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \
106
+#define BOOST_CLASS_REQUIRES4(type_var1, type_var2, type_var3, type_var4, ns, concept) \
107
+  typedef void (ns::concept <type_var1,type_var2,type_var3,type_var4>::* func##type_var1##type_var2##type_var3##type_var4##concept)(); \
108
   template <func##type_var1##type_var2##type_var3##type_var4##concept _Tp1> \
109
   struct concept_checking_##type_var1##type_var2##type_var3##type_var4##concept { }; \
110
   typedef concept_checking_##type_var1##type_var2##type_var3##type_var4##concept< \
111
-    BOOST_FPTR concept <type_var1,type_var2,type_var3,type_var4>::constraints>  \
112
+    &ns::concept <type_var1,type_var2,type_var3,type_var4>::constraints>  \
113
     concept_checking_typedef_##type_var1##type_var2##type_var3##type_var4##concept
114
 
115
 
116
-#endif
117
-
118
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
119
 template <class T, class U>
120
 struct require_same { };
121
 
122
 template <class T>
123
 struct require_same<T,T> { typedef T type; };
124
-#else
125
-// This version does not perform checking, but will not do any harm.
126
-template <class T, class U>
127
-struct require_same { typedef T type; };
128
-#endif
129
+
130
+  template <class T, class U>
131
+  struct SameTypeConcept
132
+  {
133
+    void constraints() {
134
+      typedef typename require_same<T, U>::type req;
135
+    }
136
+  };
137
 
138
   template <class T>
139
   struct IntegerConcept {
140
     void constraints() {
141
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
142
       errortype_must_be_an_integer_type();
143
-#endif
144
     }
145
   };
146
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
147
   template <> struct IntegerConcept<short> { void constraints() {} };
148
   template <> struct IntegerConcept<unsigned short> { void constraints() {} };
149
   template <> struct IntegerConcept<int> { void constraints() {} };
150
@@ -108,32 +87,24 @@
151
   template <> struct IntegerConcept<long> { void constraints() {} };
152
   template <> struct IntegerConcept<unsigned long> { void constraints() {} };
153
   // etc.
154
-#endif
155
 
156
   template <class T>
157
   struct SignedIntegerConcept {
158
     void constraints() {
159
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
160
       errortype_must_be_a_signed_integer_type();
161
-#endif
162
     }
163
   };
164
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
165
   template <> struct SignedIntegerConcept<short> { void constraints() {} };
166
   template <> struct SignedIntegerConcept<int> { void constraints() {} };
167
   template <> struct SignedIntegerConcept<long> { void constraints() {} };
168
   // etc.
169
-#endif
170
 
171
   template <class T>
172
   struct UnsignedIntegerConcept {
173
     void constraints() {
174
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
175
       errortype_must_be_an_unsigned_integer_type();
176
-#endif
177
     }
178
   };
179
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
180
   template <> struct UnsignedIntegerConcept<unsigned short>
181
     { void constraints() {} };
182
   template <> struct UnsignedIntegerConcept<unsigned int>
183
@@ -141,7 +112,6 @@
184
   template <> struct UnsignedIntegerConcept<unsigned long>
185
     { void constraints() {} };
186
   // etc.
187
-#endif
188
 
189
   //===========================================================================
190
   // Basic Concepts
191
@@ -159,15 +129,11 @@
192
   struct AssignableConcept
193
   {
194
     void constraints() {
195
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
196
       a = a;              // require assignment operator
197
-#endif
198
       const_constraints(a);
199
     }
200
     void const_constraints(const TT& b) {
201
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
202
       a = b;              // const required for argument to assignment
203
-#endif
204
     }
205
     TT a;
206
   };
207
@@ -196,17 +162,13 @@
208
   {
209
     void constraints() {
210
       TT b(a);
211
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
212
       a = a;              // require assignment operator
213
-#endif
214
       const_constraints(a);
215
       ignore_unused_variable_warning(b);
216
     }
217
     void const_constraints(const TT& b) {
218
       TT c(b);
219
-#if !defined(_ITERATOR_) // back_insert_iterator broken for VC++ STL
220
       a = b;              // const required for argument to assignment
221
-#endif
222
       ignore_unused_variable_warning(c);
223
     }
224
     TT a;
225
@@ -304,6 +266,9 @@
226
   BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, SubtractOpConcept);
227
   BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, ModOpConcept);
228
 
229
+#undef BOOST_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT
230
+#undef BOOST_DEFINE_BINARY_OPERATOR_CONSTRAINT
231
+
232
   //===========================================================================
233
   // Function Object Concepts
234
 
235
@@ -318,7 +283,6 @@
236
   };
237
 
238
 
239
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
240
   template <class Func>
241
   struct GeneratorConcept<Func,void>
242
   {
243
@@ -327,7 +291,6 @@
244
     }
245
     Func f;
246
   };
247
-#endif
248
 
249
   template <class Func, class Return, class Arg>
250
   struct UnaryFunctionConcept
251
@@ -340,7 +303,6 @@
252
     Return r;
253
   };
254
 
255
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
256
   template <class Func, class Arg>
257
   struct UnaryFunctionConcept<Func, void, Arg> {
258
     void constraints() {
259
@@ -348,7 +310,6 @@
260
     }
261
     Func f;
262
   };
263
-#endif
264
 
265
   template <class Func, class Return, class First, class Second>
266
   struct BinaryFunctionConcept
267
@@ -362,7 +323,6 @@
268
     Return r;
269
   };
270
 
271
-#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
272
   template <class Func, class First, class Second>
273
   struct BinaryFunctionConcept<Func, void, First, Second>
274
   {
275
@@ -373,7 +333,6 @@
276
     First first;
277
     Second second;
278
   };
279
-#endif
280
 
281
   template <class Func, class Arg>
282
   struct UnaryPredicateConcept
283
@@ -422,9 +381,7 @@
284
       function_requires< AssignableConcept<TT> >();
285
       function_requires< DefaultConstructibleConcept<TT> >();
286
       function_requires< EqualityComparableConcept<TT> >();
287
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
288
       typedef typename std::iterator_traits<TT>::value_type V;
289
-#endif
290
       (void)*i;           // require dereference operator
291
     }
292
     TT i;
293
@@ -446,7 +403,6 @@
294
     void constraints() {
295
       function_requires< TrivialIteratorConcept<TT> >();
296
       // require iterator_traits typedef's
297
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
298
       typedef typename std::iterator_traits<TT>::difference_type D;
299
       function_requires< SignedIntegerConcept<D> >();
300
       typedef typename std::iterator_traits<TT>::reference R;
301
@@ -455,7 +411,6 @@
302
       function_requires< ConvertibleConcept<
303
         typename std::iterator_traits<TT>::iterator_category,
304
         std::input_iterator_tag> >();
305
-#endif
306
       ++i;                // require preincrement operator
307
       i++;                // require postincrement operator
308
     }
309
@@ -471,7 +426,7 @@
310
       i++;                // require postincrement operator
311
       *i++ = t;           // require postincrement and assignment
312
     }
313
-    TT i, j;
314
+    TT i;
315
     ValueT t;
316
   };
317
 
318
@@ -480,14 +435,12 @@
319
   {
320
     void constraints() {
321
       function_requires< InputIteratorConcept<TT> >();
322
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
323
       function_requires< ConvertibleConcept<
324
         typename std::iterator_traits<TT>::iterator_category,
325
         std::forward_iterator_tag> >();
326
       typedef typename std::iterator_traits<TT>::reference reference;
327
       reference r = *i;
328
       ignore_unused_variable_warning(r);
329
-#endif
330
     }
331
     TT i;
332
   };
333
@@ -507,11 +460,9 @@
334
   {
335
     void constraints() {
336
       function_requires< ForwardIteratorConcept<TT> >();
337
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
338
       function_requires< ConvertibleConcept<
339
         typename std::iterator_traits<TT>::iterator_category,
340
         std::bidirectional_iterator_tag> >();
341
-#endif
342
       --i;                // require predecrement operator
343
       i--;                // require postdecrement operator
344
     }
345
@@ -536,12 +487,10 @@
346
     void constraints() {
347
       function_requires< BidirectionalIteratorConcept<TT> >();
348
       function_requires< ComparableConcept<TT> >();
349
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
350
       function_requires< ConvertibleConcept<
351
         typename std::iterator_traits<TT>::iterator_category,
352
         std::random_access_iterator_tag> >();
353
       typedef typename std::iterator_traits<TT>::reference R;
354
-#endif
355
 
356
       i += n;             // require assignment addition operator
357
       i = i + n; i = n + i; // require addition with difference type
358
@@ -552,11 +501,7 @@
359
     }
360
     TT a, b;
361
     TT i, j;
362
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
363
     typename std::iterator_traits<TT>::difference_type n;
364
-#else
365
-    std::ptrdiff_t n;
366
-#endif
367
   };
368
 
369
   template <class TT>
370
@@ -568,11 +513,7 @@
371
       i[n] = *i;                  // require element access and assignment
372
     }
373
     TT i;
374
-#ifndef BOOST_NO_STD_ITERATOR_TRAITS
375
     typename std::iterator_traits<TT>::difference_type n;
376
-#else
377
-    std::ptrdiff_t n;
378
-#endif
379
   };
380
 
381
   //===========================================================================
382
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.