epoc32/include/stdapis/stlport/stl/concept_checks.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/stdapis/stlport/stl/concept_checks.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/stdapis/stlport/stl/concept_checks.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,810 @@
     1.4 -concept_checks.h
     1.5 +/*
     1.6 + * Copyright (c) 1999
     1.7 + * Silicon Graphics Computer Systems, Inc.
     1.8 + *
     1.9 + * Permission to use, copy, modify, distribute and sell this software
    1.10 + * and its documentation for any purpose is hereby granted without fee,
    1.11 + * provided that the above copyright notice appear in all copies and
    1.12 + * that both that copyright notice and this permission notice appear
    1.13 + * in supporting documentation.  Silicon Graphics makes no
    1.14 + * representations about the suitability of this software for any
    1.15 + * purpose.  It is provided "as is" without express or implied warranty.
    1.16 + */
    1.17 +
    1.18 +#ifndef __CONCEPT_CHECKS_H
    1.19 +#define __CONCEPT_CHECKS_H
    1.20 +
    1.21 +/*
    1.22 +  Use these macro like assertions, but they assert properties
    1.23 +  on types (usually template arguments). In technical terms they
    1.24 +  verify whether a type "models" a "concept".
    1.25 +
    1.26 +  This set of requirements and the terminology used here is derived
    1.27 +  from the book "Generic Programming and the STL" by Matt Austern
    1.28 +  (Addison Wesley). For further information please consult that
    1.29 +  book. The requirements also are intended to match the ANSI/ISO C++
    1.30 +  standard.
    1.31 +
    1.32 +  This file covers the basic concepts and the iterator concepts.
    1.33 +  There are several other files that provide the requirements
    1.34 +  for the STL containers:
    1.35 +    container_concepts.h
    1.36 +    sequence_concepts.h
    1.37 +    assoc_container_concepts.h
    1.38 +
    1.39 +  Jeremy Siek, 1999
    1.40 +
    1.41 +  TO DO:
    1.42 +    - some issues with regards to concept classification and mutability
    1.43 +      including AssociativeContianer -> ForwardContainer
    1.44 +      and SortedAssociativeContainer -> ReversibleContainer
    1.45 +    - HashedAssociativeContainer
    1.46 +    - Allocator
    1.47 +    - Function Object Concepts
    1.48 +
    1.49 +  */
    1.50 +
    1.51 +#ifndef _STLP_USE_CONCEPT_CHECKS
    1.52 +
    1.53 +// Some compilers lack the features that are necessary for concept checks.
    1.54 +// On those compilers we define the concept check macros to do nothing.
    1.55 +#define _STLP_REQUIRES(__type_var, __concept) do {} while(0)
    1.56 +#define _STLP_CLASS_REQUIRES(__type_var, __concept) \
    1.57 +  static int  __##__type_var##_##__concept
    1.58 +#define _STLP_CONVERTIBLE(__type_x, __type_y) do {} while(0)
    1.59 +#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
    1.60 +#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
    1.61 +  static int  __##__type_x##__type_y##_require_same_type
    1.62 +#define _STLP_GENERATOR_CHECK(__func, __ret) do {} while(0)
    1.63 +#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \
    1.64 +  static int  __##__func##__ret##_generator_check
    1.65 +#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
    1.66 +#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
    1.67 +  static int  __##__func##__ret##__arg##_unary_function_check
    1.68 +#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
    1.69 +  do {} while(0)
    1.70 +#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
    1.71 +  static int  __##__func##__ret##__first##__second##_binary_function_check
    1.72 +#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
    1.73 +  do {} while(0)
    1.74 +#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
    1.75 +  static int __##__opname##__ret##__first##__second##_require_binary_op
    1.76 +
    1.77 +#else /* _STLP_USE_CONCEPT_CHECKS */
    1.78 +
    1.79 +// This macro tests whether the template argument "__type_var"
    1.80 +// satisfies the requirements of "__concept".  Here is a list of concepts
    1.81 +// that we know how to check:
    1.82 +//       _Allocator
    1.83 +//       _Assignable
    1.84 +//       _DefaultConstructible
    1.85 +//       _EqualityComparable
    1.86 +//       _LessThanComparable
    1.87 +//       _TrivialIterator
    1.88 +//       _InputIterator
    1.89 +//       _OutputIterator
    1.90 +//       _ForwardIterator
    1.91 +//       _BidirectionalIterator
    1.92 +//       _RandomAccessIterator
    1.93 +//       _Mutable_TrivialIterator
    1.94 +//       _Mutable_ForwardIterator
    1.95 +//       _Mutable_BidirectionalIterator
    1.96 +//       _Mutable_RandomAccessIterator
    1.97 +
    1.98 +#define _STLP_REQUIRES(__type_var, __concept) \
    1.99 +do { \
   1.100 +  void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
   1.101 +    ::##__concept##_requirement_violation; __x = __x; } while (0)
   1.102 +
   1.103 +// Use this to check whether type X is convertible to type Y
   1.104 +#define _STLP_CONVERTIBLE(__type_x, __type_y) \
   1.105 +do { \
   1.106 +  void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \
   1.107 +  __type_y >::__type_X_is_not_convertible_to_type_Y; \
   1.108 +  __x = __x; } while (0)
   1.109 +
   1.110 +// Use this to test whether two template arguments are the same type
   1.111 +#define _STLP_REQUIRES_SAME_TYPE(__type_x, __type_y) \
   1.112 +do { \
   1.113 +  void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
   1.114 +    __type_y  >::__type_X_not_same_as_type_Y; \
   1.115 +  __x = __x; } while (0)
   1.116 +
   1.117 +
   1.118 +// function object checks
   1.119 +#define _STLP_GENERATOR_CHECK(__func, __ret) \
   1.120 +do { \
   1.121 +  __ret (*__x)( __func&) = \
   1.122 +     _STL_GENERATOR_ERROR< \
   1.123 +  __func, __ret>::__generator_requirement_violation; \
   1.124 +  __x = __x; } while (0)
   1.125 +
   1.126 +
   1.127 +#define _STLP_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
   1.128 +do { \
   1.129 +  __ret (*__x)( __func&, const __arg& ) = \
   1.130 +     _STL_UNARY_FUNCTION_ERROR< \
   1.131 +  __func, __ret, __arg>::__unary_function_requirement_violation; \
   1.132 +  __x = __x; } while (0)
   1.133 +
   1.134 +
   1.135 +#define _STLP_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
   1.136 +do { \
   1.137 +  __ret (*__x)( __func&, const __first&, const __second& ) = \
   1.138 +     _STL_BINARY_FUNCTION_ERROR< \
   1.139 +  __func, __ret, __first, __second>::__binary_function_requirement_violation; \
   1.140 +  __x = __x; } while (0)
   1.141 +
   1.142 +
   1.143 +#define _STLP_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
   1.144 +    do { \
   1.145 +  __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
   1.146 +    __ret, __first, __second>::__binary_operator_requirement_violation; \
   1.147 +  __ret (*__y)( const __first&, const __second& ) = \
   1.148 +    _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \
   1.149 +      __const_binary_operator_requirement_violation; \
   1.150 +  __y = __y; __x = __x; } while (0)
   1.151 +
   1.152 +
   1.153 +#ifdef _STLP_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
   1.154 +
   1.155 +#define _STLP_CLASS_REQUIRES(__type_var, __concept)
   1.156 +#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
   1.157 +#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret)
   1.158 +#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
   1.159 +#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
   1.160 +#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
   1.161 +
   1.162 +#else
   1.163 +
   1.164 +// Use this macro inside of template classes, where you would
   1.165 +// like to place requirements on the template arguments to the class
   1.166 +// Warning: do not pass pointers and such (e.g. T*) in as the __type_var,
   1.167 +// since the type_var is used to construct identifiers. Instead typedef
   1.168 +// the pointer type, then use the typedef name for the __type_var.
   1.169 +#define _STLP_CLASS_REQUIRES(__type_var, __concept) \
   1.170 +  typedef void (* __func##__type_var##__concept)( __type_var ); \
   1.171 +  template <__func##__type_var##__concept _Tp1> \
   1.172 +  struct __dummy_struct_##__type_var##__concept { }; \
   1.173 +  static __dummy_struct_##__type_var##__concept< \
   1.174 +    __concept##_concept_specification< \
   1.175 +      __type_var>::__concept##_requirement_violation>  \
   1.176 +  __dummy_ptr_##__type_var##__concept
   1.177 +
   1.178 +
   1.179 +#define _STLP_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
   1.180 +  typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \
   1.181 +                                                            __type_y ); \
   1.182 +  template < __func_##__type_x##__type_y##same_type _Tp1> \
   1.183 +  struct __dummy_struct_##__type_x##__type_y##_same_type { }; \
   1.184 +  static __dummy_struct_##__type_x##__type_y##_same_type< \
   1.185 +    _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y>  \
   1.186 +  __dummy_ptr_##__type_x##__type_y##_same_type
   1.187 +
   1.188 +
   1.189 +#define _STLP_CLASS_GENERATOR_CHECK(__func, __ret) \
   1.190 +  typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
   1.191 +  template <__f_##__func##__ret##_generator _Tp1> \
   1.192 +  struct __dummy_struct_##__func##__ret##_generator { }; \
   1.193 +  static __dummy_struct_##__func##__ret##_generator< \
   1.194 +    _STL_GENERATOR_ERROR< \
   1.195 +      __func, __ret>::__generator_requirement_violation>  \
   1.196 +  __dummy_ptr_##__func##__ret##_generator
   1.197 +
   1.198 +
   1.199 +#define _STLP_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
   1.200 +  typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \
   1.201 +                                                         const __arg& ); \
   1.202 +  template <__f_##__func##__ret##__arg##_unary_check _Tp1> \
   1.203 +  struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \
   1.204 +  static __dummy_struct_##__func##__ret##__arg##_unary_check< \
   1.205 +    _STL_UNARY_FUNCTION_ERROR< \
   1.206 +      __func, __ret, __arg>::__unary_function_requirement_violation>  \
   1.207 +  __dummy_ptr_##__func##__ret##__arg##_unary_check
   1.208 +
   1.209 +
   1.210 +#define _STLP_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
   1.211 +  typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\
   1.212 +                                                    const __second& ); \
   1.213 +  template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \
   1.214 +  struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \
   1.215 +  static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \
   1.216 +    _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \
   1.217 +  __binary_function_requirement_violation>  \
   1.218 +  __dummy_ptr_##__func##__ret##__first##__second##_binary_check
   1.219 +
   1.220 +
   1.221 +#define _STLP_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
   1.222 +  typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \
   1.223 +                                                    const __second& ); \
   1.224 +  template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \
   1.225 +  struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \
   1.226 +  static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \
   1.227 +    _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \
   1.228 +  __binary_operator_requirement_violation>  \
   1.229 +  __dummy_ptr_##__func##__ret##__first##__second##_binary_op
   1.230 +
   1.231 +#endif
   1.232 +
   1.233 +/* helper class for finding non-const version of a type. Need to have
   1.234 +   something to assign to etc. when testing constant iterators. */
   1.235 +
   1.236 +template <class _Tp>
   1.237 +struct _Mutable_trait {
   1.238 +  typedef _Tp _Type;
   1.239 +};
   1.240 +template <class _Tp>
   1.241 +struct _Mutable_trait<const _Tp> {
   1.242 +  typedef _Tp _Type;
   1.243 +};
   1.244 +
   1.245 +
   1.246 +/* helper function for avoiding compiler warnings about unused variables */
   1.247 +template <class _Type>
   1.248 +void __sink_unused_warning(_Type) { }
   1.249 +
   1.250 +template <class _TypeX, class _TypeY>
   1.251 +struct _STL_CONVERT_ERROR {
   1.252 +  static void
   1.253 +  __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) {
   1.254 +    _TypeY __y = __x;
   1.255 +    __sink_unused_warning(__y);
   1.256 +  }
   1.257 +};
   1.258 +
   1.259 +
   1.260 +template <class _Type> struct __check_equal { };
   1.261 +
   1.262 +template <class _TypeX, class _TypeY>
   1.263 +struct _STL_SAME_TYPE_ERROR {
   1.264 +  static void
   1.265 +  __type_X_not_same_as_type_Y(_TypeX , _TypeY ) { 
   1.266 +    __check_equal<_TypeX> t1 = __check_equal<_TypeY>();
   1.267 +  }
   1.268 +};
   1.269 +
   1.270 +
   1.271 +// Some Functon Object Checks
   1.272 +
   1.273 +template <class _Func, class _Ret>
   1.274 +struct _STL_GENERATOR_ERROR {
   1.275 +  static _Ret __generator_requirement_violation(_Func& __f) {
   1.276 +    return __f();
   1.277 +  }
   1.278 +};
   1.279 +
   1.280 +template <class _Func>
   1.281 +struct _STL_GENERATOR_ERROR<_Func, void> {
   1.282 +  static void __generator_requirement_violation(_Func& __f) {
   1.283 +    __f();
   1.284 +  }
   1.285 +};
   1.286 +
   1.287 +
   1.288 +template <class _Func, class _Ret, class _Arg>
   1.289 +struct _STL_UNARY_FUNCTION_ERROR {
   1.290 +  static _Ret
   1.291 +  __unary_function_requirement_violation(_Func& __f,
   1.292 +                                          const _Arg& __arg) {
   1.293 +    return __f(__arg);
   1.294 +  }
   1.295 +};
   1.296 +
   1.297 +template <class _Func, class _Arg>
   1.298 +struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> {
   1.299 +  static void
   1.300 +  __unary_function_requirement_violation(_Func& __f,
   1.301 +                                          const _Arg& __arg) {
   1.302 +    __f(__arg);
   1.303 +  }
   1.304 +};
   1.305 +
   1.306 +template <class _Func, class _Ret, class _First, class _Second>
   1.307 +struct _STL_BINARY_FUNCTION_ERROR {
   1.308 +  static _Ret
   1.309 +  __binary_function_requirement_violation(_Func& __f,
   1.310 +                                          const _First& __first, 
   1.311 +                                          const _Second& __second) {
   1.312 +    return __f(__first, __second);
   1.313 +  }
   1.314 +};
   1.315 +
   1.316 +template <class _Func, class _First, class _Second>
   1.317 +struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> {
   1.318 +  static void
   1.319 +  __binary_function_requirement_violation(_Func& __f,
   1.320 +                                          const _First& __first, 
   1.321 +                                          const _Second& __second) {
   1.322 +    __f(__first, __second);
   1.323 +  }
   1.324 +};
   1.325 +
   1.326 +
   1.327 +#define _STLP_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
   1.328 +template <class _Ret, class _First, class _Second> \
   1.329 +struct _STL_BINARY##_NAME##_ERROR { \
   1.330 +  static _Ret \
   1.331 +  __const_binary_operator_requirement_violation(const _First& __first,  \
   1.332 +                                                const _Second& __second) { \
   1.333 +    return __first _OP __second; \
   1.334 +  } \
   1.335 +  static _Ret \
   1.336 +  __binary_operator_requirement_violation(_First& __first,  \
   1.337 +                                          _Second& __second) { \
   1.338 +    return __first _OP __second; \
   1.339 +  } \
   1.340 +}
   1.341 +
   1.342 +_STLP_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
   1.343 +_STLP_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
   1.344 +_STLP_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
   1.345 +_STLP_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
   1.346 +_STLP_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
   1.347 +_STLP_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
   1.348 +_STLP_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
   1.349 +_STLP_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
   1.350 +_STLP_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
   1.351 +_STLP_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
   1.352 +_STLP_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);
   1.353 +// ...
   1.354 +
   1.355 +// TODO, add unary operators (prefix and postfix)
   1.356 +
   1.357 +/*
   1.358 +  The presence of this class is just to trick EDG into displaying
   1.359 +  these error messages before any other errors. Without the
   1.360 +  classes, the errors in the functions get reported after
   1.361 +  other class errors deep inside the library. The name
   1.362 +  choice just makes for an eye catching error message :)
   1.363 + */
   1.364 +struct _STL_ERROR {
   1.365 +
   1.366 +  template <class _Type>
   1.367 +  static _Type
   1.368 +  __default_constructor_requirement_violation(_Type) {
   1.369 +    return _Type();
   1.370 +  }
   1.371 +  template <class _Type>
   1.372 +  static _Type
   1.373 +  __assignment_operator_requirement_violation(_Type __a) {
   1.374 +    __a = __a;
   1.375 +    return __a;
   1.376 +  }
   1.377 +  template <class _Type>
   1.378 +  static _Type
   1.379 +  __copy_constructor_requirement_violation(_Type __a) {
   1.380 +    _Type __c(__a);
   1.381 +    return __c;
   1.382 +  }
   1.383 +  template <class _Type>
   1.384 +  static _Type
   1.385 +  __const_parameter_required_for_copy_constructor(_Type /* __a */, 
   1.386 +                                                  const _Type& __b) {
   1.387 +    _Type __c(__b);
   1.388 +    return __c;
   1.389 +  }
   1.390 +  template <class _Type>
   1.391 +  static _Type
   1.392 +  __const_parameter_required_for_assignment_operator(_Type __a, 
   1.393 +                                                     const _Type& __b) {
   1.394 +    __a = __b;
   1.395 +    return __a;
   1.396 +  }
   1.397 +  template <class _Type>
   1.398 +  static _Type
   1.399 +  __less_than_comparable_requirement_violation(_Type __a, _Type __b) {
   1.400 +    if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a;
   1.401 +    return __b;
   1.402 +  }
   1.403 +  template <class _Type>
   1.404 +  static _Type
   1.405 +  __equality_comparable_requirement_violation(_Type __a, _Type __b) {
   1.406 +    if (__a == __b || __a != __b) return __a;
   1.407 +    return __b;
   1.408 +  }
   1.409 +  template <class _Iterator>
   1.410 +  static void
   1.411 +  __dereference_operator_requirement_violation(_Iterator __i) {
   1.412 +    __sink_unused_warning(*__i);
   1.413 +  }
   1.414 +  template <class _Iterator>
   1.415 +  static void
   1.416 +  __dereference_operator_and_assignment_requirement_violation(_Iterator __i) {
   1.417 +    *__i = *__i;
   1.418 +  }
   1.419 +  template <class _Iterator>
   1.420 +  static void
   1.421 +  __preincrement_operator_requirement_violation(_Iterator __i) {
   1.422 +    ++__i;
   1.423 +  }
   1.424 +  template <class _Iterator>
   1.425 +  static void
   1.426 +  __postincrement_operator_requirement_violation(_Iterator __i) {
   1.427 +    __i++;
   1.428 +  }
   1.429 +  template <class _Iterator>
   1.430 +  static void
   1.431 +  __predecrement_operator_requirement_violation(_Iterator __i) {
   1.432 +    --__i;
   1.433 +  }
   1.434 +  template <class _Iterator>
   1.435 +  static void
   1.436 +  __postdecrement_operator_requirement_violation(_Iterator __i) {
   1.437 +    __i--;
   1.438 +  }
   1.439 +  template <class _Iterator, class _Type>
   1.440 +  static void
   1.441 +  __postincrement_operator_and_assignment_requirement_violation(_Iterator __i,
   1.442 +                                                                _Type __t) {
   1.443 +    *__i++ = __t;
   1.444 +  }
   1.445 +  template <class _Iterator, class _Distance>
   1.446 +  static _Iterator
   1.447 +  __iterator_addition_assignment_requirement_violation(_Iterator __i, 
   1.448 +                                                       _Distance __n) {
   1.449 +    __i += __n;
   1.450 +    return __i;
   1.451 +  }
   1.452 +  template <class _Iterator, class _Distance>
   1.453 +  static _Iterator
   1.454 +  __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) {
   1.455 +    __i = __i + __n;
   1.456 +    __i = __n + __i;
   1.457 +    return __i;
   1.458 +  }
   1.459 +  template <class _Iterator, class _Distance>
   1.460 +  static _Iterator
   1.461 +  __iterator_subtraction_assignment_requirement_violation(_Iterator __i,
   1.462 +                                                          _Distance __n) {
   1.463 +    __i -= __n;
   1.464 +    return __i;
   1.465 +  }
   1.466 +  template <class _Iterator, class _Distance>
   1.467 +  static _Iterator
   1.468 +  __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) {
   1.469 +    __i = __i - __n;
   1.470 +    return __i;
   1.471 +  }
   1.472 +  template <class _Iterator, class _Distance>
   1.473 +  static _Distance
   1.474 +  __difference_operator_requirement_violation(_Iterator __i, _Iterator __j,
   1.475 +                                              _Distance __n) {
   1.476 +    __n = __i - __j;
   1.477 +    return __n;
   1.478 +  }
   1.479 +  template <class _Exp, class _Type, class _Distance>
   1.480 +  static _Type
   1.481 +  __element_access_operator_requirement_violation(_Exp __x, _Type*,
   1.482 +                                                  _Distance __n) {
   1.483 +    return __x[__n];
   1.484 +  }
   1.485 +  template <class _Exp, class _Type, class _Distance>
   1.486 +  static void
   1.487 +  __element_assignment_operator_requirement_violation(_Exp __x,
   1.488 +                                                      _Type* __t,
   1.489 +                                                      _Distance __n) {
   1.490 +    __x[__n] = *__t;
   1.491 +  }
   1.492 +
   1.493 +}; /* _STL_ERROR */
   1.494 +
   1.495 +/* Associated Type Requirements */
   1.496 +
   1.497 +_STLP_BEGIN_NAMESPACE
   1.498 +template <class _Iterator> struct iterator_traits;
   1.499 +_STLP_END_NAMESPACE
   1.500 +
   1.501 +template <class _Iter> 
   1.502 +struct __value_type_type_definition_requirement_violation {
   1.503 +  typedef typename __STD::iterator_traits<_Iter>::value_type value_type;
   1.504 +};
   1.505 +
   1.506 +template <class _Iter> 
   1.507 +struct __difference_type_type_definition_requirement_violation {
   1.508 +  typedef typename __STD::iterator_traits<_Iter>::difference_type
   1.509 +          difference_type;
   1.510 +};
   1.511 +
   1.512 +template <class _Iter> 
   1.513 +struct __reference_type_definition_requirement_violation {
   1.514 +  typedef typename __STD::iterator_traits<_Iter>::reference reference;
   1.515 +};
   1.516 +
   1.517 +template <class _Iter> 
   1.518 +struct __pointer_type_definition_requirement_violation {
   1.519 +  typedef typename __STD::iterator_traits<_Iter>::pointer pointer;
   1.520 +};
   1.521 +
   1.522 +template <class _Iter> 
   1.523 +struct __iterator_category_type_definition_requirement_violation {
   1.524 +  typedef typename __STD::iterator_traits<_Iter>::iterator_category 
   1.525 +          iterator_category;
   1.526 +};
   1.527 +
   1.528 +/* Assignable Requirements */
   1.529 +
   1.530 +
   1.531 +template <class _Type>
   1.532 +struct _Assignable_concept_specification {
   1.533 +  static void _Assignable_requirement_violation(_Type __a) {
   1.534 +    _STL_ERROR::__assignment_operator_requirement_violation(__a);
   1.535 +    _STL_ERROR::__copy_constructor_requirement_violation(__a);
   1.536 +    _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a);
   1.537 +    _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a);
   1.538 +  }
   1.539 +};
   1.540 +
   1.541 +/* DefaultConstructible Requirements */
   1.542 +
   1.543 +
   1.544 +template <class _Type>
   1.545 +struct _DefaultConstructible_concept_specification {
   1.546 +  static void _DefaultConstructible_requirement_violation(_Type __a) {
   1.547 +    _STL_ERROR::__default_constructor_requirement_violation(__a);
   1.548 +  }
   1.549 +};
   1.550 +
   1.551 +/* EqualityComparable Requirements */
   1.552 +
   1.553 +template <class _Type>
   1.554 +struct _EqualityComparable_concept_specification {
   1.555 +  static void _EqualityComparable_requirement_violation(_Type __a) {
   1.556 +    _STL_ERROR::__equality_comparable_requirement_violation(__a, __a);
   1.557 +  }
   1.558 +};
   1.559 +
   1.560 +/* LessThanComparable Requirements */
   1.561 +template <class _Type>
   1.562 +struct _LessThanComparable_concept_specification {
   1.563 +  static void _LessThanComparable_requirement_violation(_Type __a) {
   1.564 +    _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a);
   1.565 +  }
   1.566 +};
   1.567 +
   1.568 +/* TrivialIterator Requirements */
   1.569 +
   1.570 +template <class _TrivialIterator>
   1.571 +struct _TrivialIterator_concept_specification {
   1.572 +static void
   1.573 +_TrivialIterator_requirement_violation(_TrivialIterator __i) {
   1.574 +  typedef typename
   1.575 +    __value_type_type_definition_requirement_violation<_TrivialIterator>::
   1.576 +    value_type __T;
   1.577 +  // Refinement of Assignable
   1.578 +  _Assignable_concept_specification<_TrivialIterator>::
   1.579 +    _Assignable_requirement_violation(__i);
   1.580 +  // Refinement of DefaultConstructible
   1.581 +  _DefaultConstructible_concept_specification<_TrivialIterator>::
   1.582 +    _DefaultConstructible_requirement_violation(__i);
   1.583 +  // Refinement of EqualityComparable
   1.584 +  _EqualityComparable_concept_specification<_TrivialIterator>::
   1.585 +    _EqualityComparable_requirement_violation(__i);
   1.586 +  // Valid Expressions
   1.587 +  _STL_ERROR::__dereference_operator_requirement_violation(__i);
   1.588 +}
   1.589 +};
   1.590 +
   1.591 +template <class _TrivialIterator>
   1.592 +struct _Mutable_TrivialIterator_concept_specification {
   1.593 +static void
   1.594 +_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) {
   1.595 +  _TrivialIterator_concept_specification<_TrivialIterator>::
   1.596 +    _TrivialIterator_requirement_violation(__i);
   1.597 +  // Valid Expressions
   1.598 +  _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i);
   1.599 +}
   1.600 +};
   1.601 +
   1.602 +/* InputIterator Requirements */
   1.603 +
   1.604 +template <class _InputIterator>
   1.605 +struct _InputIterator_concept_specification {
   1.606 +static void
   1.607 +_InputIterator_requirement_violation(_InputIterator __i) {
   1.608 +  // Refinement of TrivialIterator
   1.609 +  _TrivialIterator_concept_specification<_InputIterator>::
   1.610 +    _TrivialIterator_requirement_violation(__i);
   1.611 +  // Associated Types
   1.612 +  __difference_type_type_definition_requirement_violation<_InputIterator>();
   1.613 +  __reference_type_definition_requirement_violation<_InputIterator>();
   1.614 +  __pointer_type_definition_requirement_violation<_InputIterator>();
   1.615 +  __iterator_category_type_definition_requirement_violation<_InputIterator>();
   1.616 +  // Valid Expressions
   1.617 +  _STL_ERROR::__preincrement_operator_requirement_violation(__i);
   1.618 +  _STL_ERROR::__postincrement_operator_requirement_violation(__i);
   1.619 +}
   1.620 +};
   1.621 +
   1.622 +/* OutputIterator Requirements */
   1.623 +
   1.624 +template <class _OutputIterator>
   1.625 +struct _OutputIterator_concept_specification {
   1.626 +static void
   1.627 +_OutputIterator_requirement_violation(_OutputIterator __i) {
   1.628 +  // Refinement of Assignable
   1.629 +  _Assignable_concept_specification<_OutputIterator>::
   1.630 +    _Assignable_requirement_violation(__i);
   1.631 +  // Associated Types
   1.632 +  __iterator_category_type_definition_requirement_violation<_OutputIterator>();
   1.633 +  // Valid Expressions
   1.634 +  _STL_ERROR::__dereference_operator_requirement_violation(__i);
   1.635 +  _STL_ERROR::__preincrement_operator_requirement_violation(__i);
   1.636 +  _STL_ERROR::__postincrement_operator_requirement_violation(__i);
   1.637 +  _STL_ERROR::
   1.638 +    __postincrement_operator_and_assignment_requirement_violation(__i, *__i);
   1.639 +}
   1.640 +};
   1.641 +
   1.642 +/* ForwardIterator Requirements */
   1.643 +
   1.644 +template <class _ForwardIterator>
   1.645 +struct _ForwardIterator_concept_specification {
   1.646 +static void
   1.647 +_ForwardIterator_requirement_violation(_ForwardIterator __i) {
   1.648 +  // Refinement of InputIterator
   1.649 +  _InputIterator_concept_specification<_ForwardIterator>::
   1.650 +    _InputIterator_requirement_violation(__i);
   1.651 +}
   1.652 +};
   1.653 +
   1.654 +template <class _ForwardIterator>
   1.655 +struct _Mutable_ForwardIterator_concept_specification {
   1.656 +static void
   1.657 +_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) {
   1.658 +  _ForwardIterator_concept_specification<_ForwardIterator>::
   1.659 +    _ForwardIterator_requirement_violation(__i);
   1.660 +  // Refinement of OutputIterator
   1.661 +  _OutputIterator_concept_specification<_ForwardIterator>::
   1.662 +    _OutputIterator_requirement_violation(__i);
   1.663 +}
   1.664 +};
   1.665 +
   1.666 +/* BidirectionalIterator Requirements */
   1.667 +
   1.668 +template <class _BidirectionalIterator>
   1.669 +struct _BidirectionalIterator_concept_specification {
   1.670 +static void
   1.671 +_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) {
   1.672 +  // Refinement of ForwardIterator
   1.673 +  _ForwardIterator_concept_specification<_BidirectionalIterator>::
   1.674 +    _ForwardIterator_requirement_violation(__i);
   1.675 +  // Valid Expressions
   1.676 +  _STL_ERROR::__predecrement_operator_requirement_violation(__i);
   1.677 +  _STL_ERROR::__postdecrement_operator_requirement_violation(__i);
   1.678 +}
   1.679 +};
   1.680 +
   1.681 +template <class _BidirectionalIterator>
   1.682 +struct _Mutable_BidirectionalIterator_concept_specification {
   1.683 +static void
   1.684 +_Mutable_BidirectionalIterator_requirement_violation(
   1.685 +       _BidirectionalIterator __i)
   1.686 +{
   1.687 +  _BidirectionalIterator_concept_specification<_BidirectionalIterator>::
   1.688 +    _BidirectionalIterator_requirement_violation(__i);
   1.689 +  // Refinement of mutable_ForwardIterator
   1.690 +  _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>::
   1.691 +    _Mutable_ForwardIterator_requirement_violation(__i);
   1.692 +  typedef typename
   1.693 +    __value_type_type_definition_requirement_violation<
   1.694 +    _BidirectionalIterator>::value_type __T;
   1.695 +  typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0;
   1.696 +  // Valid Expressions
   1.697 +  _STL_ERROR::
   1.698 +    __postincrement_operator_and_assignment_requirement_violation(__i,
   1.699 +                                                                  *__tmp_ptr);
   1.700 +}
   1.701 +};
   1.702 +
   1.703 +/* RandomAccessIterator Requirements */
   1.704 +
   1.705 +template <class _RandAccIter>
   1.706 +struct _RandomAccessIterator_concept_specification {
   1.707 +static void
   1.708 +_RandomAccessIterator_requirement_violation(_RandAccIter __i) {
   1.709 +  // Refinement of BidirectionalIterator
   1.710 +  _BidirectionalIterator_concept_specification<_RandAccIter>::
   1.711 +    _BidirectionalIterator_requirement_violation(__i);
   1.712 +  // Refinement of LessThanComparable
   1.713 +  _LessThanComparable_concept_specification<_RandAccIter>::
   1.714 +    _LessThanComparable_requirement_violation(__i);
   1.715 +  typedef typename 
   1.716 +        __value_type_type_definition_requirement_violation<_RandAccIter>
   1.717 +        ::value_type
   1.718 +    value_type;
   1.719 +  typedef typename
   1.720 +        __difference_type_type_definition_requirement_violation<_RandAccIter>
   1.721 +        ::difference_type 
   1.722 +    _Dist;
   1.723 +  typedef typename _Mutable_trait<_Dist>::_Type _MutDist;
   1.724 +
   1.725 +  // Valid Expressions
   1.726 +  _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i,
   1.727 +                                                                   _MutDist());
   1.728 +  _STL_ERROR::__iterator_addition_requirement_violation(__i,
   1.729 +                                                        _MutDist());
   1.730 +  _STL_ERROR::
   1.731 +    __iterator_subtraction_assignment_requirement_violation(__i,
   1.732 +                                                            _MutDist());
   1.733 +  _STL_ERROR::__iterator_subtraction_requirement_violation(__i,
   1.734 +                                                           _MutDist());
   1.735 +  _STL_ERROR::__difference_operator_requirement_violation(__i, __i,
   1.736 +                                                          _MutDist());
   1.737 +  typename _Mutable_trait<value_type>::_Type* __dummy_ptr = 0;
   1.738 +  _STL_ERROR::__element_access_operator_requirement_violation(__i,
   1.739 +                                                              __dummy_ptr,
   1.740 +                                                              _MutDist());
   1.741 +}
   1.742 +};
   1.743 +
   1.744 +template <class _RandAccIter>
   1.745 +struct _Mutable_RandomAccessIterator_concept_specification {
   1.746 +static void
   1.747 +_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i)
   1.748 +{
   1.749 +  _RandomAccessIterator_concept_specification<_RandAccIter>::
   1.750 +    _RandomAccessIterator_requirement_violation(__i);
   1.751 +  // Refinement of mutable_BidirectionalIterator
   1.752 +  _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>::
   1.753 +    _Mutable_BidirectionalIterator_requirement_violation(__i);
   1.754 +  typedef typename
   1.755 +        __value_type_type_definition_requirement_violation<_RandAccIter>
   1.756 +        ::value_type
   1.757 +    value_type;
   1.758 +  typedef typename
   1.759 +        __difference_type_type_definition_requirement_violation<_RandAccIter>
   1.760 +        ::difference_type
   1.761 +    _Dist;
   1.762 +
   1.763 +  typename _Mutable_trait<value_type>::_Type* __tmp_ptr = 0;
   1.764 +  // Valid Expressions
   1.765 +  _STL_ERROR::__element_assignment_operator_requirement_violation(__i,
   1.766 +                  __tmp_ptr, _Dist());
   1.767 +}
   1.768 +};
   1.769 +
   1.770 +#define _STLP_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
   1.771 +template <class Type> \
   1.772 +struct __##__REQUIREMENT##__typedef_requirement_violation { \
   1.773 +  typedef typename Type::__REQUIREMENT __REQUIREMENT; \
   1.774 +};
   1.775 +
   1.776 +_STLP_TYPEDEF_REQUIREMENT(value_type);
   1.777 +_STLP_TYPEDEF_REQUIREMENT(difference_type);
   1.778 +_STLP_TYPEDEF_REQUIREMENT(size_type);
   1.779 +_STLP_TYPEDEF_REQUIREMENT(reference);
   1.780 +_STLP_TYPEDEF_REQUIREMENT(const_reference);
   1.781 +_STLP_TYPEDEF_REQUIREMENT(pointer);
   1.782 +_STLP_TYPEDEF_REQUIREMENT(const_pointer);
   1.783 +
   1.784 +
   1.785 +template <class _Alloc>
   1.786 +struct _Allocator_concept_specification {
   1.787 +static void
   1.788 +_Allocator_requirement_violation(_Alloc __a) {
   1.789 +  // Refinement of DefaultConstructible
   1.790 +  _DefaultConstructible_concept_specification<_Alloc>::
   1.791 +    _DefaultConstructible_requirement_violation(__a);
   1.792 +  // Refinement of EqualityComparable
   1.793 +  _EqualityComparable_concept_specification<_Alloc>::
   1.794 +    _EqualityComparable_requirement_violation(__a);
   1.795 +  // Associated Types
   1.796 +  __value_type__typedef_requirement_violation<_Alloc>();
   1.797 +  __difference_type__typedef_requirement_violation<_Alloc>();
   1.798 +  __size_type__typedef_requirement_violation<_Alloc>();
   1.799 +  __reference__typedef_requirement_violation<_Alloc>();
   1.800 +  __const_reference__typedef_requirement_violation<_Alloc>();
   1.801 +  __pointer__typedef_requirement_violation<_Alloc>();
   1.802 +  __const_pointer__typedef_requirement_violation<_Alloc>();
   1.803 +  typedef typename _Alloc::value_type _Type;
   1.804 +  _STLP_REQUIRES_SAME_TYPE(typename _Alloc::rebind<_Type>::other, _Alloc);
   1.805 +}
   1.806 +};
   1.807 +
   1.808 +#endif /* _STLP_USE_CONCEPT_CHECKS */
   1.809 +
   1.810 +#endif /* __CONCEPT_CHECKS_H */
   1.811 +
   1.812 +// Local Variables:
   1.813 +// mode:C++
   1.814 +// End: