Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

88 righe
1.5 KiB

  1. #pragma once
  2. #include <cstddef>
  3. #include <type_traits>
  4. namespace cppmp
  5. {
  6. /**
  7. * @brief Evaluates to void.
  8. */
  9. template<typename...>
  10. using void_t = void;
  11. /**
  12. * @brief Store a single type.
  13. */
  14. template<typename X>
  15. struct type_t
  16. { };
  17. #ifdef cppmp_supports_variable_templates
  18. template<typename X>
  19. constexpr decltype(auto) type_v = type_t<X> { };
  20. #endif
  21. /**
  22. * @brief Simple type list.
  23. */
  24. template<typename...>
  25. struct list
  26. { };
  27. /**
  28. * @brief Inherit from all passed types.
  29. */
  30. template<typename... T>
  31. struct inherit
  32. : public T...
  33. { };
  34. /**
  35. * @brief Type to wrap constant values at compile time.
  36. */
  37. template<typename T, T t>
  38. struct integral_constant
  39. : public std::integral_constant<T, t>
  40. { };
  41. /**
  42. * @brief Boolean constant type.
  43. */
  44. template<bool B>
  45. struct bool_t
  46. : public integral_constant<bool, B>
  47. { };
  48. /**
  49. * @brief True boolean constant type.
  50. */
  51. struct true_t
  52. : public bool_t<true>
  53. { };
  54. /**
  55. * @brief False boolean constant type.
  56. */
  57. struct false_t
  58. : public bool_t<false>
  59. { };
  60. /**
  61. * @brief Size contant type.
  62. */
  63. template<size_t S>
  64. struct size_t
  65. : public integral_constant<std::size_t, S>
  66. { };
  67. /**
  68. * @brief Zero zize constant type.
  69. */
  70. struct zero_t
  71. : public size_t<0>
  72. { };
  73. }