0showsupport.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. /*
  2. * Simple test file for cxxomfort
  3. * When compiled and run, this will print information about the
  4. * C++ and cxxomfort install.
  5. *
  6. * 0info.cpp is a much simpler version that only
  7. * outputs the information of cxxomfort's info object.
  8. *
  9. * This and other examples assume cxxomfort is installed in
  10. * include library path; if otherwise, set eg.: -I flag accordingly.
  11. */
  12. //#define CXXOMFORT_NOTICES 2
  13. #include <cxxomfort/base.hpp>
  14. #include <cxxomfort/backports.hpp>
  15. #include <cxxomfort/library/type_name.hpp>
  16. //#include <cxxomfort/library.hpp>
  17. #include <iterator>
  18. #include <iostream>
  19. #include <iomanip>
  20. #include <list>
  21. void show_support (unsigned v, const char* const text, std::ostream& os= std::cout);
  22. void show_implementation (char const * const name, unsigned p, std::ostream& os= std::cout);
  23. void report_integrals ();
  24. void report_endianness ();
  25. void report_tr1 ();
  26. void show_impls_cxx11 (std::ostream&);
  27. void show_impls_cxx14 (std::ostream&);
  28. void show_impls_cxx17 (std::ostream&);
  29. void show_impls_algorithm (std::ostream&);
  30. void show_impls_string (std::ostream&);
  31. void show_impls_string_view (std::ostream&);
  32. void show_impls_tuple (std::ostream&);
  33. void show_impls_alignment (std::ostream& os);
  34. bool is_even (int x) { return x % 2 == 0; }
  35. int int_transform (int x) { return x+1; }
  36. typedef std::array<int,5> Arr;
  37. static Arr aexpl = {{2, 3, 5, 7, 11}};
  38. int main () {
  39. using namespace std;
  40. cxxomfort::output_info();
  41. cout<< endl;
  42. report_integrals();
  43. report_endianness();
  44. cout<< "Found supported by the compiler:"<< endl;
  45. cout<< "\nc++03\n";
  46. show_support(CXXO_COMPILER_SUPPORT_functional_oldstyle, "cxx03-oldstyle-objects");
  47. cout<< endl;
  48. report_tr1();
  49. #if defined(_POSIX_VERSION)
  50. cout<< "POSIX: "<< _POSIX_VERSION<< endl;
  51. #endif
  52. /*
  53. show_header(CXXO_CXXSTDHEADER_array, "<array>");
  54. show_support(CXXO_CXXSTDHEADER_cstdint, "<cstdint>");
  55. show_support(CXXO_CXXSTDHEADER_cinttypes, "<cinttypes>");
  56. show_support(CXXO_CXXSTDHEADER_cuchar, "<cuchar>");
  57. show_support(CXXO_CXXSTDHEADER_ratio, "<ratio>");
  58. show_support(CXXO_CXXSTDHEADER_tuple, "<tuple>");
  59. show_support(CXXO_CXXSTDHEADER_type_traits, "<type_traits>");
  60. show_support(CXXO_CXXSTDHEADER_system_error, "<system_error>");
  61. */
  62. cout<< "\n\nc++11\n";
  63. show_support(CXXO_COMPILER_SUPPORT_initializer_list, "initializer_list");
  64. show_support(CXXO_COMPILER_SUPPORT_alignof, "alignof()");
  65. show_support(CXXO_COMPILER_SUPPORT_alignment_tools, "aligned_...");
  66. show_support(CXXO_COMPILER_SUPPORT_attribute, "[[attribute]]");
  67. show_support(CXXO_COMPILER_SUPPORT_auto, "c++11 auto");
  68. show_support(CXXO_COMPILER_SUPPORT_common_type, "common_type");
  69. show_support(CXXO_COMPILER_SUPPORT_conditional_enableif, "enable_if/conditional");
  70. show_support(CXXO_COMPILER_SUPPORT_constexpr, "constexpr");
  71. show_support(CXXO_COMPILER_SUPPORT_constexpr_dereference, "constexpr dereference");
  72. show_support(CXXO_COMPILER_SUPPORT_decltype, "decltype()");
  73. show_support(CXXO_COMPILER_SUPPORT_default_delete, "= default/delete");
  74. show_support(CXXO_COMPILER_SUPPORT_enum_class, "enum class");
  75. show_support(CXXO_COMPILER_SUPPORT_explicit_operator, "T::explicit operator");
  76. show_support(CXXO_COMPILER_SUPPORT_foreach, "foreach(elem : range)");
  77. show_support(CXXO_COMPILER_SUPPORT_inheriting_constructors, "inheriting constructors");
  78. show_support(CXXO_COMPILER_SUPPORT_local_types, "local_types_in_templates");
  79. show_support(CXXO_COMPILER_SUPPORT_noexcept, "noexcept(...)");
  80. show_support(CXXO_COMPILER_SUPPORT_nullptr, "nullptr");
  81. show_support(CXXO_COMPILER_SUPPORT_rvref, "T&&");
  82. show_support(CXXO_COMPILER_SUPPORT_static_assert, "static_assert()");
  83. show_support(CXXO_COMPILER_SUPPORT_std_is_constructible_traits, "is_constructible");
  84. show_support(CXXO_COMPILER_SUPPORT_std_is_trivially, "is_trivially...");
  85. show_support(CXXO_COMPILER_SUPPORT_iterator_accessors_11, "iterator_helpers");
  86. show_support(CXXO_COMPILER_SUPPORT_udl_s_basic_string, "\"\"s basic_string");
  87. show_support(CXXO_COMPILER_SUPPORT_unique_ptr, "unique_ptr");
  88. show_support(CXXO_COMPILER_SUPPORT_user_defined_literals, "user defined literals");
  89. show_support(CXXO_COMPILER_SUPPORT_variadic, "variadic_templates");
  90. cout<< "\n\nc++14\n";
  91. show_support(CXXO_COMPILER_SUPPORT_attribute_deprecated, "attribute[[deprecated]]");
  92. show_support(CXXO_COMPILER_SUPPORT_constexpr_relaxed, "constexpr_relaxed");
  93. show_support(CXXO_COMPILER_SUPPORT_decltypeauto, "decltype(auto)");
  94. show_support(CXXO_COMPILER_SUPPORT_transparent_operators_functional, "transparent plus<> etc");
  95. show_support(CXXO_COMPILER_SUPPORT_integer_sequence, "integer_sequence<>");
  96. show_support(CXXO_COMPILER_SUPPORT_nsdmi, "NSDMI");
  97. show_support(CXXO_COMPILER_SUPPORT_trailing_returns, "() -> return_type");
  98. cout<< "\n\nc++17\n";
  99. show_support(CXXO_CXXSTDHEADER_any, "<any");
  100. show_support(CXXO_CXXSTDHEADER_optional, "<optional>");
  101. show_support(CXXO_CXXSTDHEADER_string_view, "<string_view>");
  102. show_support(CXXO_CXXSTDHEADER_variant, "<variant>");
  103. show_support(CXXO_COMPILER_SUPPORT_bool_constant, "bool_constant<B>");
  104. show_support(CXXO_COMPILER_SUPPORT_std_byte, "byte");
  105. show_support(CXXO_COMPILER_SUPPORT_invoke, "invoke(f, ...)");
  106. show_support(CXXO_COMPILER_SUPPORT_udl_sv_basic_string_view, "\"\"sv basic_string_view");
  107. cout<< "\n\nc++20\n";
  108. show_support(CXXO_CXXSTDHEADER_endian, "<endian>");
  109. show_support(CXXO_COMPILER_SUPPORT_bit_cast, "bit_cast<>");
  110. //show_support(CXXO_COMPILER_SUPPORT_std_span, "std::span");
  111. cout<< "\nOther:\n";
  112. show_support(CXXO_COMPILER_SUPPORT_va_args , "variadic_macros");
  113. show_support(CXXO_COMPILER_SUPPORT_typeof, "__typeof__()");
  114. show_support(CXXO_COMPILER_SUPPORT_type_intrinsics, "__is_type_intrinsics()");
  115. cout<< "\n"<< endl;
  116. cout<< "\nFeatures of cxxomfort: "<< endl;
  117. cout<< "\n-- Keywords and Properties --"<< endl;
  118. show_implementation("[[attribute]]", CXXOMFORT_IMPLEMENTS_attribute);
  119. show_implementation("CXXO_TYPEOF", CXXOMFORT_IMPLEMENTS_typeof);
  120. show_implementation("CXXO_DECLTYPE", CXXOMFORT_IMPLEMENTS_decltype);
  121. show_implementation("CXXO_EXPLICIT_OPERATOR", CXXOMFORT_IMPLEMENTS_explicit_operator);
  122. show_implementation("CXXO_FOREACH", CXXOMFORT_IMPLEMENTS_foreach);
  123. show_implementation("integer typedefs", CXXOMFORT_IMPLEMENTS_cstdint_integrals);
  124. show_implementation("cxxomfort:nullptr", CXXOMFORT_IMPLEMENTS_nullptr);
  125. show_implementation("cxxomfort:static_assert", CXXOMFORT_IMPLEMENTS_static_assert);
  126. cout<< "\n-- Types and Functions --"<< endl;
  127. //print_impls_cxx11(cout);
  128. //print_impls_cxx14(cout);
  129. //print_impls_cxx17(cout);
  130. //print_impls_cxx20(cout);
  131. show_impls_algorithm(cout);
  132. cout<< "byte (std::byte): "<< endl;
  133. show_implementation("std::byte", CXXOMFORT_IMPLEMENTS_byte);
  134. //show_impl_byte();
  135. show_implementation("character types C++11", CXXOMFORT_IMPLEMENTS_charn_types);
  136. #if (defined(__cpp_unicode_character_types))
  137. {
  138. u16string u1;
  139. cout<< " char16_t is: "<< cxxomfort::type_name<char16_t>()<< endl;
  140. }
  141. #endif
  142. cout<< "callable utilities:"<< endl;
  143. show_implementation(" mem_fn", CXXOMFORT_IMPLEMENTS_mem_fn);
  144. show_implementation(" invoke", CXXOMFORT_IMPLEMENTS_invoke);
  145. #if (CXXOMFORT_IMPLEMENTS_invoke>0)
  146. {
  147. cout<< " invoke printf: ";
  148. invoke(printf, "Hola %s\n", "mundo");
  149. }
  150. #endif
  151. show_implementation(" invoke_r", CXXOMFORT_IMPLEMENTS_invoke_r);
  152. #if (CXXOMFORT_IMPLEMENTS_invoke_r>0)
  153. {
  154. cout<< " invoke_r printf: ";
  155. invoke_r<int>(printf, "Hola %s\n", "mundo");
  156. }
  157. #endif
  158. show_implementation(" bind_front", CXXOMFORT_IMPLEMENTS_bind_front);
  159. #if (CXXOMFORT_IMPLEMENTS_bind_front>0 && CXXO_COMPILER_SUPPORT_auto)
  160. {
  161. cout<< " bind_front test: ";
  162. auto fnb = bind_front(printf, "Hola %s\n");
  163. fnb("mundo");
  164. }
  165. #endif
  166. show_implementation("bit_cast", CXXOMFORT_IMPLEMENTS_bit_cast);
  167. show_implementation("destroy_at", CXXOMFORT_IMPLEMENTS_destroy_at);
  168. //show_implementation("[enable_if/conditional]", CXXOMFORT_IMPLEMENTS_enableif);
  169. show_implementation("endian", CXXOMFORT_IMPLEMENTS_endian);
  170. {
  171. cout<< " endianness \t: "<< "native="<< (unsigned)endian::native<< " big="<< (unsigned)endian::big<< " little="<< (unsigned)endian::little<< endl;
  172. }
  173. show_implementation("heterogeneous <functional>", CXXOMFORT_IMPLEMENTS_heterogeneous_operator_functors);
  174. show_implementation("integer_sequence", CXXOMFORT_IMPLEMENTS_integer_sequence);
  175. cout<< "Iterator accessors:"<< endl;
  176. show_implementation("C++11: begin, end ", CXXOMFORT_IMPLEMENTS_iterator_accessors_11);
  177. show_implementation("C++14: cbegin, rbegin, etc ", CXXOMFORT_IMPLEMENTS_iterator_accessors_14);
  178. show_implementation("C++17: size, data, etc ", CXXOMFORT_IMPLEMENTS_iterator_accessors_17);
  179. //show_implementation("ssize(Sequence)", CXXO_IMPLEMENTS_ssize);
  180. show_impls_string(cout);
  181. cout<< endl;
  182. show_impls_string_view(cout);
  183. cout<< endl;
  184. show_implementation("<system_error> utilities", CXXOMFORT_IMPLEMENTS_header_system_error);
  185. //show_implementation(" POSIX 2008 errc", CXXOMFORT_IMPLEMENTS_posix2008_errc);
  186. show_implementation(" hash<std::error_code>", 0);
  187. {
  188. hash<std::error_code> H; (void)H;
  189. }
  190. show_implementation("timespec_get", CXXOMFORT_IMPLEMENTS_timespec_get);
  191. show_implementation("tuple<...>", CXXOMFORT_IMPLEMENTS_tuple);
  192. show_implementation(" get<type>(Tuple)", CXXOMFORT_IMPLEMENTS_tuple_get_type);
  193. #if (CXXOMFORT_IMPLEMENTS_tuple_get_type>0)
  194. {
  195. std::string str1 = make_from_tuple<std::string>(std::make_tuple(12, '*'));
  196. std::tuple<std::string, int, float> tu1 ("text", 2, -1.1f);
  197. cout<< " assert on get<int> of tuple"<< endl;
  198. assert(std::get<int>(tu1)==2);
  199. }
  200. #endif
  201. show_implementation(" make_from_tuple", CXXOMFORT_IMPLEMENTS_make_from_tuple);
  202. #if (CXXOMFORT_IMPLEMENTS_make_from_tuple>0)
  203. {
  204. std::string str1 = make_from_tuple<std::string>(std::make_tuple(12, '*'));
  205. cout<< " make_from_tuple -> string: "<< str1<< endl;
  206. }
  207. #endif
  208. show_implementation(" tuple_apply", CXXOMFORT_IMPLEMENTS_tuple_apply);
  209. #if (CXXOMFORT_IMPLEMENTS_tuple_apply>0)
  210. {
  211. }
  212. #endif
  213. cout<< "type traits and related utilities:"<< endl;
  214. show_implementation(" integral_constant", CXXOMFORT_IMPLEMENTS_integral_constant);
  215. show_implementation(" callable() ", CXXOMFORT_IMPLEMENTS_integral_constant_callable);
  216. show_implementation(" bool_constant", CXXOMFORT_IMPLEMENTS_bool_constant);
  217. #if (CXXOMFORT_IMPLEMENTS_bool_constant>0)
  218. {
  219. std::bool_constant<false> f;
  220. cout<< " false: "<< f.value<< endl;
  221. }
  222. #endif
  223. show_implementation(" common_type<Args...>" , CXXOMFORT_IMPLEMENTS_common_type);
  224. show_implementation(" underlying_type<Enum>" , CXXOMFORT_IMPLEMENTS_underlying_type);
  225. #if (CXXOMFORT_IMPLEMENTS_underlying_type>0)
  226. {
  227. enum test1 { val1 = 11, };
  228. typedef std::underlying_type<test1>::type U;
  229. cout<< " underlying test name: "<< cxxomfort::type_name< U >()<< endl;
  230. }
  231. #endif
  232. show_implementation("make_void<...> " , CXXOMFORT_IMPLEMENTS_make_void);
  233. show_implementation("using void_t= " , CXXOMFORT_IMPLEMENTS_std_void_t);
  234. show_implementation("unique_ptr", CXXOMFORT_IMPLEMENTS_unique_ptr);
  235. show_implementation(" hash<>", 0);
  236. show_implementation(" make_unique", CXXOMFORT_IMPLEMENTS_make_unique);
  237. #if (CXXOMFORT_IMPLEMENTS_make_unique>0)
  238. {
  239. unique_ptr<string> us = make_unique<string>("Hola Mundo");
  240. cout<< " make_unique test *ptr: "<< *us<< endl;
  241. }
  242. #endif
  243. cout<< "<utility> and related utilities:"<< endl;
  244. show_implementation(" exchange function", CXXOMFORT_IMPLEMENTS_exchange);
  245. #if (CXXOMFORT_IMPLEMENTS_exchange>0)
  246. {
  247. int exA= 4, exB= 7;
  248. printf(" exchange values %d %d ", exA, exB);
  249. std::exchange(exA, exB);
  250. printf(" -> %d %d \n", exA, exB);
  251. assert(exA==7);
  252. }
  253. #endif
  254. cout<< endl;
  255. //show_implementation("void_t transformation", CXXOMFORT_IMPLEMENTS_n3911);
  256. #if 0
  257. cout<< "\n-- Library Supplements --"<< endl;
  258. show_implementation("array_ref", CXXOMFORT_IMPLEMENTS_array_ref);
  259. show_implementation("fixed_vector", CXXOMFORT_IMPLEMENTS_fixed_vector);
  260. show_implementation("function_ref", CXXOMFORT_IMPLEMENTS_function_ref);
  261. show_implementation("tuple operations", CXXOMFORT_IMPLEMENTS_tuple_operations);
  262. //show_implementation("hexdump/hexload", CXXOMFORT_IMPLEMENTS_hex);
  263. //show_implementation("is_scoped_enum<T>", CXXO_IMPLEMENTS_is_scoped_enum);
  264. #endif
  265. cout<< endl;
  266. bool_constant<false> F_;
  267. (void)F_;
  268. show_impls_alignment(cout);
  269. cout<< endl;
  270. }
  271. void show_header (unsigned v, std::string_view text, std::ostream& os) {
  272. using namespace std;
  273. if (v) {
  274. os<< text<< " ["<< v<< "]"<< " \t";
  275. }
  276. }
  277. void show_support (unsigned v, const char* const text, std::ostream& os) {
  278. using namespace std;
  279. if (v) {
  280. os<< text<< " \t["<< v<< "]"<< endl;
  281. } else {
  282. }
  283. }
  284. void show_implementation (char const* const name, unsigned p, std::ostream& os) {
  285. using namespace std;
  286. #if (CXXOMFORT_CXX_STD >= 1997)
  287. os<< setw(24)<< left<< name<< " \t: ";
  288. #else
  289. os<< name<< " \t: ";
  290. #endif
  291. if (p == CXXO_IMPLSTATUS_LIBRARY() ) {
  292. os<< "supplemental";
  293. } else if (p == CXXO_IMPLSTATUS_NATIVE() ) {
  294. os<< "c++-native";
  295. } else if (p > CXXO_IMPLSTATUS_BACKPORT() ) {
  296. os<< "backport L"<< (p-CXXO_IMPLSTATUS_BACKPORT());
  297. } else if (p == CXXO_IMPLSTATUS_BACKPORT() ) {
  298. os<< "backport";
  299. } else if (p >= CXXO_IMPLSTATUS_EMULATION() ) {
  300. os<< "emulation L"<< (p-CXXO_IMPLSTATUS_EMULATION());
  301. } else if (p != 0) {
  302. os<< "partial status";
  303. } else {
  304. os<< "unavail/unknown";
  305. }
  306. os<< endl;
  307. }
  308. void report_tr1 () {
  309. using namespace std;
  310. cout<< "TR1: "<< CXXOFLAG_tr1
  311. << " dir:"<< CXXOFLAG_directory_tr1<< " ns:"<< CXXOFLAG_namespace_tr1
  312. << " "<< CXXO_STRINGIZE(CXXO_STDTR1_NAME())<< endl;
  313. }
  314. void report_integrals () {
  315. using namespace std;
  316. static const char* names[]= {"char", "short", "int", "long", "llong" };
  317. unsigned sizes[]= {sizeof(char), sizeof(short), sizeof(int), sizeof(long), sizeof(long long) };
  318. cout<< "sizes of integrals: "<< flush;
  319. for(unsigned i=0; i < 5 /*size(sizes)*/ ; ++i) {
  320. cout<< names[i]<< ':'<< sizes[i]<< " ";
  321. }
  322. cout<< endl;
  323. }
  324. void report_endianness () {
  325. #if (CXXOMFORT_IMPLEMENTS_endian > CXXO_IMPLSTATUS_EMULATION())
  326. using namespace std;
  327. cout<< "Machine is: ";
  328. if (endian::native == endian::little) { cout<< "little"; }
  329. else if (endian::native == endian::big) { cout<< "big"; }
  330. else cout<< "unknown";
  331. cout<< "-endian"<< endl;
  332. #else
  333. std::cout<< "endian not implemented"<< std::endl;
  334. #endif
  335. }
  336. void show_impls_cxx11 (std::ostream& os) {
  337. using namespace std;
  338. static int const LI [] = {1, 3, 5, 7, 9}; // primes, totally primes
  339. list<int> l (begin(LI), end(LI));
  340. none_of(begin(l), end(l), is_even);
  341. show_implementation("[all/any/none]_of algorithms", CXXOMFORT_IMPLEMENTS_n2569 /*CXXOMFORT_IMPLEMENTS_algorithm_anyall*/, os);
  342. }
  343. void show_impls_cxx14 (std::ostream& os) {
  344. (void)os;
  345. using namespace std;
  346. }
  347. void show_impls_cxx17 (std::ostream& os) {
  348. using namespace std;
  349. using cxxomfort::to_byte;
  350. std::byte by = to_byte('c');
  351. (void)by;
  352. show_implementation("byte", CXXOMFORT_IMPLEMENTS_byte, os);
  353. }
  354. void show_impls_algorithm (std::ostream& os) {
  355. using namespace std;
  356. show_implementation("any_ algorithms C++11", CXXOMFORT_IMPLEMENTS_algorithm_allanynoneof);
  357. #if (CXXOMFORT_IMPLEMENTS_algorithm_allanynoneof)
  358. os<< " testing call: "<< any_of(begin(aexpl),end(aexpl),is_even)<< endl;
  359. #endif
  360. show_implementation("minmax algorithms C++11", CXXOMFORT_IMPLEMENTS_algorithm_minmax);
  361. #if (CXXOMFORT_IMPLEMENTS_algorithm_minmax)
  362. os<< " testing minmax: ";
  363. pair< Arr::iterator,Arr::iterator > pmm= minmax_element(begin(aexpl),end(aexpl));
  364. os<< *pmm.first<< " , "<< *pmm.second<< endl;
  365. #endif
  366. show_implementation("sort algorithms C++11", CXXOMFORT_IMPLEMENTS_algorithm_sorted);
  367. #if (CXXOMFORT_IMPLEMENTS_algorithm_sorted)
  368. os<< " test is_sorted: "<< is_sorted(begin(aexpl), end(aexpl))<< endl;
  369. #endif
  370. show_implementation("equal/mismatch update C++14", CXXOMFORT_IMPLEMENTS_equal_mismatch_full_ranges);
  371. show_implementation("clamp C++17", CXXOMFORT_IMPLEMENTS_clamp);
  372. clamp(aexpl[1], aexpl[2], aexpl[3]);
  373. show_implementation("shift_ algorithms C++20", CXXOMFORT_IMPLEMENTS_algorithm_shift);
  374. #if (CXXOMFORT_IMPLEMENTS_algorithm_shift)
  375. os<< "invoke shift.."<< endl;
  376. shift_left(begin(aexpl), end(aexpl), 1);
  377. shift_right(begin(aexpl), end(aexpl), 1);
  378. #endif
  379. }
  380. void show_impls_string (std::ostream& os) {
  381. using namespace std;
  382. show_implementation("<string> utilities", CXXOMFORT_IMPLEMENTS_string, os);
  383. show_implementation(" hash<>", CXXOMFORT_IMPLEMENTS_stdhash_string, os);
  384. show_implementation(" s literal", CXXOMFORT_IMPLEMENTS_udl_s, os);
  385. { hash<wstring> H; wstring s(L"1"); size_t h= H(s); (void)h; }
  386. }
  387. void show_impls_string_view (std::ostream& os) {
  388. using namespace std;
  389. show_implementation("<string_view> utilities", CXXOMFORT_IMPLEMENTS_header_string_view, os);
  390. show_implementation(" basic_string_view", CXXOMFORT_IMPLEMENTS_string_view, os);
  391. show_implementation(" hash<>", CXXOMFORT_IMPLEMENTS_stdhash_string_view, os);
  392. show_implementation(" sv literal", CXXOMFORT_IMPLEMENTS_udl_sv, os);
  393. { hash<wstring_view> H; wstring_view s(L"1"); size_t h= H(s); (void)h; }
  394. }
  395. void show_impls_alignment (std::ostream& os) {
  396. using namespace std;
  397. cout<< "alignof support: "<< CXXO_COMPILER_SUPPORT_alignof<< endl;
  398. os<< "alignof(int): "<< alignof(int)<< endl;
  399. cout<< "alignment tools support: "<< CXXO_COMPILER_SUPPORT_alignment_tools<< endl;
  400. cout<< "aligned_storage support: "<< CXXOMFORT_IMPLEMENTS_aligned_storage<< endl;
  401. aligned_storage<12, 4>::type A;
  402. (void)A;
  403. //os<< "alignment_storage<12,4> : "<< sizeof(A)<< " "<< alignof(A)<< endl;
  404. }