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