meta.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include<__vic/meta.h>
  2. #include<iostream>
  3. #include<exception>
  4. #include<cassert>
  5. namespace tests {
  6. void run()
  7. {
  8. assert(( __vic::is_same<int, int>::value));
  9. assert((!__vic::is_same<int, short>::value));
  10. assert((!__vic::is_same<int, const int>::value));
  11. assert( __vic::is_const<const int>::value);
  12. assert(!__vic::is_const<int>::value);
  13. assert( __vic::is_signed_integer<int>::value);
  14. assert( __vic::is_signed_integer<signed char>::value);
  15. assert(!__vic::is_signed_integer<unsigned>::value);
  16. assert(!__vic::is_signed_integer<double>::value);
  17. assert( __vic::is_unsigned_integer<unsigned>::value);
  18. assert(!__vic::is_unsigned_integer<int>::value);
  19. assert( __vic::is_unsigned_integer<unsigned char>::value);
  20. assert((__vic::is_same<
  21. __vic::remove_const<const int>::type,
  22. int>::value));
  23. assert((__vic::is_same<
  24. __vic::remove_const<int>::type,
  25. int>::value));
  26. assert((__vic::is_same<
  27. __vic::remove_cv<const int>::type,
  28. int>::value));
  29. assert((__vic::is_same<
  30. __vic::remove_cv<volatile int>::type,
  31. int>::value));
  32. assert((__vic::is_same<
  33. __vic::remove_cv<const volatile int>::type,
  34. int>::value));
  35. assert((__vic::is_same<
  36. __vic::remove_const<int>::type,
  37. int>::value));
  38. assert((__vic::is_same<
  39. __vic::remove_pointer<int *>::type,
  40. int>::value));
  41. assert((__vic::is_same<
  42. __vic::remove_pointer<int>::type,
  43. int>::value));
  44. assert((__vic::is_same<
  45. __vic::remove_cvref<const int &>::type,
  46. int>::value));
  47. #if __cpp_variadic_templates && __cpp_alias_templates
  48. assert((__vic::is_same<
  49. __vic::make_index_sequence<4>,
  50. __vic::index_sequence<0, 1, 2, 3>
  51. >::value));
  52. assert((__vic::is_same<
  53. __vic::make_index_sequence<0>,
  54. __vic::index_sequence<>
  55. >::value));
  56. //using huge_sequence = __vic::make_index_sequence<4096>;
  57. #endif
  58. }
  59. } // namespace
  60. int main()
  61. {
  62. try
  63. {
  64. tests::run();
  65. return 0;
  66. }
  67. catch(const std::exception &ex)
  68. {
  69. std::cerr << ex.what() << '\n';
  70. }
  71. return 1;
  72. }