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.
 
 
 

403 lines
10 KiB

  1. #pragma once
  2. #include "types.h"
  3. #include "../config.h"
  4. #define cppmp_define_checker(name) \
  5. template<typename... T> \
  6. struct name \
  7. : public integral_constant<decltype(std::name<T...>::value), std::name<T...>::value> \
  8. { }; \
  9. \
  10. cppmp_define_checker_var(name)
  11. #ifdef cppmp_supports_variable_templates
  12. #define cppmp_define_checker_var(name) \
  13. template<typename... T> \
  14. constexpr decltype(auto) name ## _v = name<T...>::value;
  15. #else
  16. #define cppmp_define_checker_var(name)
  17. #endif
  18. namespace cppmp
  19. {
  20. namespace __impl
  21. {
  22. template<typename T>
  23. struct is_valid;
  24. }
  25. /**
  26. * @brief Evaluates to true_t if the passed template parameters are valid, false_t otherwise.
  27. */
  28. template<typename T>
  29. struct is_valid
  30. : public __impl::is_valid<T>
  31. { };
  32. cppmp_define_checker_var(is_valid)
  33. /**
  34. * @brief Evaluates to true_t if T is a specialization if T_template, false_t otherwise.
  35. */
  36. template<typename T, template <typename...> class T_template>
  37. struct is_specialization_of;
  38. #ifdef cppmp_supports_variable_templates
  39. template<typename T, template <typename...> class T_template>
  40. constexpr decltype(auto) is_specialization_of_v = is_specialization_of<T, T_template>::value;
  41. #endif
  42. /**
  43. * @brief Evaluates to true_t if all passed parameters are true, false_t otherwise.
  44. */
  45. template<bool... B>
  46. struct is_true;
  47. #ifdef cppmp_supports_variable_templates
  48. template<bool... B>
  49. constexpr decltype(auto) is_true_v = is_true<B...>::value;
  50. #endif
  51. /* primary type categories */
  52. #ifdef cppmp_std_supports_is_void
  53. cppmp_define_checker(is_void);
  54. #endif
  55. #ifdef cppmp_std_supports_is_null_pointer
  56. cppmp_define_checker(is_null_pointer);
  57. #endif
  58. #ifdef cppmp_std_supports_is_integral
  59. cppmp_define_checker(is_integral);
  60. #endif
  61. #ifdef cppmp_std_supports_is_floating_point
  62. cppmp_define_checker(is_floating_point);
  63. #endif
  64. #ifdef cppmp_std_supports_is_array
  65. cppmp_define_checker(is_array);
  66. #endif
  67. #ifdef cppmp_std_supports_is_pointer
  68. cppmp_define_checker(is_pointer);
  69. #endif
  70. #ifdef cppmp_std_supports_is_lvalue_reference
  71. cppmp_define_checker(is_lvalue_reference);
  72. #endif
  73. #ifdef cppmp_std_supports_is_rvalue_reference
  74. cppmp_define_checker(is_rvalue_reference);
  75. #endif
  76. #ifdef cppmp_std_supports_is_member_object_pointer
  77. cppmp_define_checker(is_member_object_pointer);
  78. #endif
  79. #ifdef cppmp_std_supports_is_member_function_pointer
  80. cppmp_define_checker(is_member_function_pointer);
  81. #endif
  82. #ifdef cppmp_std_supports_is_enum
  83. cppmp_define_checker(is_enum);
  84. #endif
  85. #ifdef cppmp_std_supports_is_union
  86. cppmp_define_checker(is_union);
  87. #endif
  88. #ifdef cppmp_std_supports_is_class
  89. cppmp_define_checker(is_class);
  90. #endif
  91. #ifdef cppmp_std_supports_is_function
  92. cppmp_define_checker(is_function);
  93. #endif
  94. /* composite type categories */
  95. #ifdef cppmp_std_supports_is_reference
  96. cppmp_define_checker(is_reference);
  97. #endif
  98. #ifdef cppmp_std_supports_is_arithmetic
  99. cppmp_define_checker(is_arithmetic);
  100. #endif
  101. #ifdef cppmp_std_supports_is_fundamental
  102. cppmp_define_checker(is_fundamental);
  103. #endif
  104. #ifdef cppmp_std_supports_is_object
  105. cppmp_define_checker(is_object);
  106. #endif
  107. #ifdef cppmp_std_supports_is_scalar
  108. cppmp_define_checker(is_scalar);
  109. #endif
  110. #ifdef cppmp_std_supports_is_compound
  111. cppmp_define_checker(is_compound);
  112. #endif
  113. #ifdef cppmp_std_supports_is_member_pointer
  114. cppmp_define_checker(is_member_pointer);
  115. #endif
  116. /* type properties */
  117. #ifdef cppmp_std_supports_is_const
  118. cppmp_define_checker(is_const);
  119. #endif
  120. #ifdef cppmp_std_supports_is_volatile
  121. cppmp_define_checker(is_volatile);
  122. #endif
  123. #ifdef cppmp_std_supports_is_trivial
  124. cppmp_define_checker(is_trivial);
  125. #endif
  126. #ifdef cppmp_std_supports_is_trivially_copyable
  127. cppmp_define_checker(is_trivially_copyable);
  128. #endif
  129. #ifdef cppmp_std_supports_is_standard_layout
  130. cppmp_define_checker(is_standard_layout);
  131. #endif
  132. #ifdef cppmp_std_supports_is_pod
  133. cppmp_define_checker(is_pod);
  134. #endif
  135. #ifdef cppmp_std_supports_is_empty
  136. cppmp_define_checker(is_empty);
  137. #endif
  138. #ifdef cppmp_std_supports_is_polymorphic
  139. cppmp_define_checker(is_polymorphic);
  140. #endif
  141. #ifdef cppmp_std_supports_is_abstract
  142. cppmp_define_checker(is_abstract);
  143. #endif
  144. #ifdef cppmp_std_supports_is_final
  145. cppmp_define_checker(is_final);
  146. #endif
  147. #ifdef cppmp_std_supports_is_aggregate
  148. cppmp_define_checker(is_aggregate);
  149. #endif
  150. #ifdef cppmp_std_supports_is_signed
  151. cppmp_define_checker(is_signed);
  152. #endif
  153. #ifdef cppmp_std_supports_is_unsigned
  154. cppmp_define_checker(is_unsigned);
  155. #endif
  156. #ifdef cppmp_std_supports_is_bounded_array
  157. cppmp_define_checker(is_bounded_array);
  158. #endif
  159. #ifdef cppmp_std_supports_is_unbounded_array
  160. cppmp_define_checker(is_unbounded_array);
  161. #endif
  162. #ifdef cppmp_std_supports_is_constructible
  163. cppmp_define_checker(is_constructible);
  164. #endif
  165. #ifdef cppmp_std_supports_is_default_constructible
  166. cppmp_define_checker(is_default_constructible);
  167. #endif
  168. #ifdef cppmp_std_supports_is_copy_constructible
  169. cppmp_define_checker(is_copy_constructible);
  170. #endif
  171. #ifdef cppmp_std_supports_is_move_constructible
  172. cppmp_define_checker(is_move_constructible);
  173. #endif
  174. #ifdef cppmp_std_supports_is_assignable
  175. cppmp_define_checker(is_assignable);
  176. #endif
  177. #ifdef cppmp_std_supports_is_copy_assignable
  178. cppmp_define_checker(is_copy_assignable);
  179. #endif
  180. #ifdef cppmp_std_supports_is_move_assignable
  181. cppmp_define_checker(is_move_assignable);
  182. #endif
  183. #ifdef cppmp_std_supports_is_swappable_with
  184. cppmp_define_checker(is_swappable_with);
  185. #endif
  186. #ifdef cppmp_std_supports_is_swappable
  187. cppmp_define_checker(is_swappable);
  188. #endif
  189. #ifdef cppmp_std_supports_is_destructible
  190. cppmp_define_checker(is_destructible);
  191. #endif
  192. #ifdef cppmp_std_supports_is_trivially_constructible
  193. cppmp_define_checker(is_trivially_constructible);
  194. #endif
  195. #ifdef cppmp_std_supports_is_trivially_default_constructible
  196. cppmp_define_checker(is_trivially_default_constructible);
  197. #endif
  198. #ifdef cppmp_std_supports_is_trivially_copy_constructible
  199. cppmp_define_checker(is_trivially_copy_constructible);
  200. #endif
  201. #ifdef cppmp_std_supports_is_trivially_move_constructible
  202. cppmp_define_checker(is_trivially_move_constructible);
  203. #endif
  204. #ifdef cppmp_std_supports_is_trivially_assignable
  205. cppmp_define_checker(is_trivially_assignable);
  206. #endif
  207. #ifdef cppmp_std_supports_is_trivially_copy_assignable
  208. cppmp_define_checker(is_trivially_copy_assignable);
  209. #endif
  210. #ifdef cppmp_std_supports_is_trivially_move_assignable
  211. cppmp_define_checker(is_trivially_move_assignable);
  212. #endif
  213. #ifdef cppmp_std_supports_is_trivially_destructible
  214. cppmp_define_checker(is_trivially_destructible);
  215. #endif
  216. #ifdef cppmp_std_supports_is_nothrow_constructible
  217. cppmp_define_checker(is_nothrow_constructible);
  218. #endif
  219. #ifdef cppmp_std_supports_is_nothrow_default_constructible
  220. cppmp_define_checker(is_nothrow_default_constructible);
  221. #endif
  222. #ifdef cppmp_std_supports_is_nothrow_copy_constructible
  223. cppmp_define_checker(is_nothrow_copy_constructible);
  224. #endif
  225. #ifdef cppmp_std_supports_is_nothrow_move_constructible
  226. cppmp_define_checker(is_nothrow_move_constructible);
  227. #endif
  228. #ifdef cppmp_std_supports_is_nothrow_assignable
  229. cppmp_define_checker(is_nothrow_assignable);
  230. #endif
  231. #ifdef cppmp_std_supports_is_nothrow_copy_assignable
  232. cppmp_define_checker(is_nothrow_copy_assignable);
  233. #endif
  234. #ifdef cppmp_std_supports_is_nothrow_move_assignable
  235. cppmp_define_checker(is_nothrow_move_assignable);
  236. #endif
  237. #ifdef cppmp_std_supports_is_nothrow_swappable_with
  238. cppmp_define_checker(is_nothrow_swappable_with);
  239. #endif
  240. #ifdef cppmp_std_supports_is_nothrow_swappable
  241. cppmp_define_checker(is_nothrow_swappable);
  242. #endif
  243. #ifdef cppmp_std_supports_is_nothrow_destructible
  244. cppmp_define_checker(is_nothrow_destructible);
  245. #endif
  246. #ifdef cppmp_std_supports_has_virtual_destructor
  247. cppmp_define_checker(has_virtual_destructor);
  248. #endif
  249. #ifdef cppmp_std_supports_has_unique_object_representations
  250. cppmp_define_checker(has_unique_object_representations);
  251. #endif
  252. #ifdef cppmp_std_supports_has_strong_structural_equality
  253. cppmp_define_checker(has_strong_structural_equality);
  254. #endif
  255. /* type property queries */
  256. #ifdef cppmp_std_supports_alignment_of
  257. cppmp_define_checker(alignment_of);
  258. #endif
  259. #ifdef cppmp_std_supports_rank
  260. cppmp_define_checker(rank);
  261. #endif
  262. #ifdef cppmp_std_supports_extent
  263. cppmp_define_checker(extent);
  264. #endif
  265. /* type relations */
  266. #ifdef cppmp_std_supports_is_same
  267. cppmp_define_checker(is_same);
  268. #endif
  269. #ifdef cppmp_std_supports_is_base_of
  270. cppmp_define_checker(is_base_of);
  271. #endif
  272. #ifdef cppmp_std_supports_is_convertible
  273. cppmp_define_checker(is_convertible);
  274. #endif
  275. #ifdef cppmp_std_supports_is_nothrow_convertible
  276. cppmp_define_checker(is_nothrow_convertible);
  277. #endif
  278. #ifdef cppmp_std_supports_is_layout_compatible
  279. cppmp_define_checker(is_layout_compatible);
  280. #endif
  281. #ifdef cppmp_std_supports_is_pointer_interconvertible_base_of
  282. cppmp_define_checker(is_pointer_interconvertible_base_of);
  283. #endif
  284. #ifdef cppmp_std_supports_is_invocable
  285. cppmp_define_checker(is_invocable);
  286. #endif
  287. #ifdef cppmp_std_supports_is_invocable_r
  288. cppmp_define_checker(is_invocable_r);
  289. #endif
  290. #ifdef cppmp_std_supports_is_nothrow_invocable
  291. cppmp_define_checker(is_nothrow_invocable);
  292. #endif
  293. #ifdef cppmp_std_supports_is_nothrow_invocable_r
  294. cppmp_define_checker(is_nothrow_invocable_r);
  295. #endif
  296. }
  297. #undef cppmp_define_checker
  298. #undef cppmp_define_checker_var
  299. #include "checker.inl"