You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

140 line
3.2 KiB

  1. #pragma once
  2. #include <cstddef>
  3. #define cppmp_define_modifier(name) \
  4. template<typename... T> \
  5. struct name \
  6. : public std::name<T...> \
  7. { }; \
  8. \
  9. template<typename... T> \
  10. using name ## _t = typename name<T...>::type
  11. namespace cppmp
  12. {
  13. template<class T>
  14. struct decay;
  15. template<typename T>
  16. using decay_t = typename decay<T>::type;
  17. /* const-volatile modifications */
  18. #ifdef cppmp_std_supports_remove_const
  19. cppmp_define_modifier(remove_const);
  20. #endif
  21. #ifdef cppmp_std_supports_remove_volatile
  22. cppmp_define_modifier(remove_volatile);
  23. #endif
  24. #ifdef cppmp_std_supports_remove_cv
  25. cppmp_define_modifier(remove_cv);
  26. #endif
  27. #ifdef cppmp_std_supports_add_const
  28. cppmp_define_modifier(add_const);
  29. #endif
  30. #ifdef cppmp_std_supports_add_volatile
  31. cppmp_define_modifier(add_volatile);
  32. #endif
  33. #ifdef cppmp_std_supports_add_cv
  34. cppmp_define_modifier(add_cv);
  35. #endif
  36. /* reference modifications */
  37. #ifdef cppmp_std_supports_remove_reference
  38. cppmp_define_modifier(remove_reference);
  39. #endif
  40. #ifdef cppmp_std_supports_add_lvalue_reference
  41. cppmp_define_modifier(add_lvalue_reference);
  42. #endif
  43. #ifdef cppmp_std_supports_add_rvalue_reference
  44. cppmp_define_modifier(add_rvalue_reference);
  45. #endif
  46. /* sign modifications */
  47. #ifdef cppmp_std_supports_make_signed
  48. cppmp_define_modifier(make_signed);
  49. #endif
  50. #ifdef cppmp_std_supports_make_unsigned
  51. cppmp_define_modifier(make_unsigned);
  52. #endif
  53. /* array modifications */
  54. #ifdef cppmp_std_supports_remove_extent
  55. cppmp_define_modifier(remove_extent);
  56. #endif
  57. #ifdef cppmp_std_supports_remove_all_extents
  58. cppmp_define_modifier(remove_all_extents);
  59. #endif
  60. /* pointer modifications */
  61. #ifdef cppmp_std_supports_add_pointer
  62. cppmp_define_modifier(add_pointer);
  63. #endif
  64. #ifdef cppmp_std_supports_remove_pointer
  65. cppmp_define_modifier(remove_pointer);
  66. #endif
  67. /* other transformations */
  68. #ifdef cppmp_std_supports_remove_cvref
  69. cppmp_define_modifier(remove_cvref);
  70. #endif
  71. #ifdef cppmp_std_supports_common_type
  72. cppmp_define_modifier(common_type);
  73. #endif
  74. #ifdef cppmp_std_supports_underlying_type
  75. cppmp_define_modifier(underlying_type);
  76. #endif
  77. #ifdef cppmp_std_supports_result_of
  78. cppmp_define_modifier(result_of);
  79. #endif
  80. #ifdef cppmp_std_supports_invoke_result
  81. cppmp_define_modifier(invoke_result);
  82. #endif
  83. #ifdef cppmp_std_supports_aligned_storage
  84. template <std::size_t Len, std::size_t Align>
  85. struct aligned_storage
  86. : public std::aligned_storage<Len, Align>
  87. { };
  88. template <std::size_t Len, std::size_t Align>
  89. using aligned_storage_t = typename aligned_storage<Len, Align>::type;
  90. #endif
  91. #ifdef cppmp_std_supports_aligned_union
  92. template <std::size_t Len, class... Types>
  93. struct aligned_union
  94. : public std::aligned_union<Len, Types...>
  95. { };
  96. template <std::size_t Len, class... Types>
  97. using aligned_union_t = typename aligned_union<Len, Types...>::type;
  98. #endif
  99. }
  100. #undef cppmp_define_modifier
  101. #include "modifier.inl"