@@ -417,6 +417,62 @@ static_assert(size_of<std_array<const volatile std_array<std_array<uint32_t, 42>
417417static_assert (size_of<std_array<std_array<const volatile std_array<uint32_t , 42 >, 24 >, 8 >>() == sizeof (uint32_t ) * 42 * 24 * 8 );
418418static_assert (size_of<const volatile std_array<const volatile std_array<const volatile std_array<uint32_t , 42 >, 24 >, 8 >&>() == sizeof (uint32_t ) * 42 * 24 * 8 );
419419
420+ // std::tuple.
421+ // ----------------------------------------------------------------------------
422+ // is_same_type decays individual types (but not tuple elements).
423+
424+ static_assert (!is_tuple<uint8_t >);
425+ static_assert (!is_tuple<std::string>);
426+ static_assert (!is_tuple<std::array<uint8_t , 42 >>);
427+ static_assert ( is_tuple<std::tuple<int , bool >>);
428+ static_assert ( is_tuple<std::tuple<>>);
429+ static_assert ( is_same_type<decltype (is_tuple<std_array<uint8_t , 0 >>), const bool >);
430+ static_assert ( is_same_type<decltype (is_tuple<std::tuple<int , bool >&>), const bool >);
431+
432+ using test_tuple = std::tuple<int &, bool &&, const std::string&>;
433+ static_assert ( is_same_type<decay_tuple<test_tuple>, decay_tuple<test_tuple>>);
434+ static_assert (!is_same_type<test_tuple, decay_tuple<test_tuple>>);
435+ static_assert (!is_same_type<decay_tuple<test_tuple>, test_tuple>);
436+
437+ static_assert (!std::is_same_v<std::tuple_element<0 , test_tuple>::type, int >);
438+ static_assert (!std::is_same_v<std::tuple_element<1 , test_tuple>::type, bool >);
439+ static_assert (!std::is_same_v<std::tuple_element<2 , test_tuple>::type, std::string>);
440+
441+ static_assert (!std::is_same_v<std::tuple_element<0 , test_tuple>::type, const int >);
442+ static_assert (!std::is_same_v<std::tuple_element<1 , test_tuple>::type, const bool >);
443+ static_assert (!std::is_same_v<std::tuple_element<2 , test_tuple>::type, const std::string>);
444+
445+ static_assert ( std::is_same_v<std::tuple_element<0 , test_tuple>::type, int &>);
446+ static_assert (!std::is_same_v<std::tuple_element<1 , test_tuple>::type, bool &>);
447+ static_assert (!std::is_same_v<std::tuple_element<2 , test_tuple>::type, std::string&>);
448+
449+ static_assert (!std::is_same_v<std::tuple_element<0 , test_tuple>::type, int &&>);
450+ static_assert ( std::is_same_v<std::tuple_element<1 , test_tuple>::type, bool &&>);
451+ static_assert (!std::is_same_v<std::tuple_element<2 , test_tuple>::type, std::string&&>);
452+
453+ using normal_test_tuple = std::tuple<int , bool , std::string>;
454+ using decayed_test_tuple = decay_tuple<test_tuple>::type;
455+ static_assert (is_same_type<normal_test_tuple, decayed_test_tuple>);
456+
457+ static_assert (std::is_same_v<std::tuple_element<0 , decayed_test_tuple>::type, int >);
458+ static_assert (std::is_same_v<std::tuple_element<1 , decayed_test_tuple>::type, bool >);
459+ static_assert (std::is_same_v<std::tuple_element<2 , decayed_test_tuple>::type, std::string>);
460+
461+ static_assert (!std::is_same_v<std::tuple_element<0 , decayed_test_tuple>::type, const int >);
462+ static_assert (!std::is_same_v<std::tuple_element<1 , decayed_test_tuple>::type, const bool >);
463+ static_assert (!std::is_same_v<std::tuple_element<2 , decayed_test_tuple>::type, const std::string>);
464+
465+ static_assert (!std::is_same_v<std::tuple_element<0 , decayed_test_tuple>::type, int &>);
466+ static_assert (!std::is_same_v<std::tuple_element<1 , decayed_test_tuple>::type, bool &>);
467+ static_assert (!std::is_same_v<std::tuple_element<2 , decayed_test_tuple>::type, std::string&>);
468+
469+ static_assert (!std::is_same_v<std::tuple_element<0 , decayed_test_tuple>::type, int &&>);
470+ static_assert (!std::is_same_v<std::tuple_element<1 , decayed_test_tuple>::type, bool &&>);
471+ static_assert (!std::is_same_v<std::tuple_element<2 , decayed_test_tuple>::type, std::string&&>);
472+
473+ // is_uintx
474+ // ----------------------------------------------------------------------------
475+
420476static_assert (is_uintx<uint5_t >);
421477static_assert (is_uintx<uint11_t >);
422478static_assert (is_uintx<uint48_t >);
0 commit comments