_ptrs_specialize.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef _STLP_PTRS_SPECIALIZE_H
  2. #define _STLP_PTRS_SPECIALIZE_H
  3. #if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) || \
  4. (defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) && !defined (_STLP_NO_ARROW_OPERATOR))
  5. # define _STLP_POINTERS_SPECIALIZE( _TpP )
  6. # define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
  7. #else
  8. # ifndef _STLP_TYPE_TRAITS_H
  9. # include <stl/type_traits.h>
  10. # endif
  11. // the following is a workaround for arrow operator problems
  12. # if defined ( _STLP_NO_ARROW_OPERATOR )
  13. // User wants to disable proxy -> operators
  14. # define _STLP_DEFINE_ARROW_OPERATOR
  15. # else
  16. // Compiler can handle generic -> operator.
  17. # if defined (__BORLANDC__)
  18. # define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(*(*this)); }
  19. # elif defined(__WATCOMC__)
  20. # define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { reference x = operator*(); return &x; }
  21. # else
  22. # define _STLP_DEFINE_ARROW_OPERATOR pointer operator->() const { return &(operator*()); }
  23. # endif
  24. # endif /* _STLP_NO_ARROW_OPERATOR */
  25. // Important pointers specializations
  26. # ifdef _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS
  27. # define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
  28. # define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type)
  29. # else
  30. # define _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type) _STLP_TEMPLATE_NULL struct __type_traits<_Type> : __type_traits_aux<__true_type> {};
  31. # define _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type) \
  32. _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type*) \
  33. _STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type*) \
  34. _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type**) \
  35. _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type* const *) \
  36. _STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type**) \
  37. _STLP_TYPE_TRAITS_POD_SPECIALIZE(_Type***) \
  38. _STLP_TYPE_TRAITS_POD_SPECIALIZE(const _Type***)
  39. # endif
  40. # define _STLP_POINTERS_SPECIALIZE(_Type) _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(_Type)
  41. _STLP_BEGIN_NAMESPACE
  42. # if !defined ( _STLP_NO_BOOL )
  43. _STLP_POINTERS_SPECIALIZE( bool )
  44. # endif
  45. _STLP_TYPE_TRAITS_POD_SPECIALIZE_V(void)
  46. # ifndef _STLP_NO_SIGNED_BUILTINS
  47. _STLP_POINTERS_SPECIALIZE( signed char )
  48. # endif
  49. _STLP_POINTERS_SPECIALIZE( char )
  50. _STLP_POINTERS_SPECIALIZE( unsigned char )
  51. _STLP_POINTERS_SPECIALIZE( short )
  52. _STLP_POINTERS_SPECIALIZE( unsigned short )
  53. _STLP_POINTERS_SPECIALIZE( int )
  54. _STLP_POINTERS_SPECIALIZE( unsigned int )
  55. _STLP_POINTERS_SPECIALIZE( long )
  56. _STLP_POINTERS_SPECIALIZE( unsigned long )
  57. _STLP_POINTERS_SPECIALIZE( float )
  58. _STLP_POINTERS_SPECIALIZE( double )
  59. # if !defined ( _STLP_NO_LONG_DOUBLE )
  60. _STLP_POINTERS_SPECIALIZE( long double )
  61. # endif
  62. # if defined ( _STLP_LONG_LONG)
  63. _STLP_POINTERS_SPECIALIZE( _STLP_LONG_LONG )
  64. _STLP_POINTERS_SPECIALIZE( unsigned _STLP_LONG_LONG )
  65. # endif
  66. # if defined ( _STLP_HAS_WCHAR_T ) && ! defined (_STLP_WCHAR_T_IS_USHORT)
  67. _STLP_POINTERS_SPECIALIZE( wchar_t )
  68. # endif
  69. _STLP_END_NAMESPACE
  70. # undef _STLP_ARROW_SPECIALIZE
  71. # undef _STLP_TYPE_TRAITS_POD_SPECIALIZE_V
  72. #endif
  73. #endif