diff --git a/include/bitcoin/system/typelets.hpp b/include/bitcoin/system/typelets.hpp index 5c4c2b0ea7..e0f528dc4a 100644 --- a/include/bitcoin/system/typelets.hpp +++ b/include/bitcoin/system/typelets.hpp @@ -100,6 +100,20 @@ struct is_std_array_t> : std::true_type {}; template constexpr bool is_std_array = is_std_array_t::value; +template +struct is_std_vector_t : std::false_type {}; +template +struct is_std_vector_t> : std::true_type {}; +template +constexpr bool is_std_vector = is_std_vector_t::value; + +template +struct is_pmr_vector_t : std::false_type {}; +template +struct is_pmr_vector_t> : std::true_type {}; +template +constexpr bool is_pmr_vector = is_pmr_vector_t::value; + template >, bool> = true> constexpr size_t array_count = std::tuple_size_v>; diff --git a/test/constraints.cpp b/test/constraints.cpp index 40419d4b5c..ee30f5b084 100644 --- a/test/constraints.cpp +++ b/test/constraints.cpp @@ -597,6 +597,7 @@ static_assert(is_defined>>); ////static_assert(!is_defined>); static_assert(is_defined>); +static_assert(is_defined>>); static_assert(is_defined>>); ////static_assert(is_defined>>); ////static_assert(!is_defined>); diff --git a/test/typelets.cpp b/test/typelets.cpp index f2d31d9d6b..22199dc6ec 100644 --- a/test/typelets.cpp +++ b/test/typelets.cpp @@ -314,12 +314,30 @@ static_assert(is_same_type, uint8_t>); static_assert(is_same_type); static_assert(is_same_type, uint8_t>); -static_assert(is_std_array>); -static_assert(is_std_array>); +static_assert(is_std_array>); +static_assert(is_std_array>); +static_assert(!is_std_array>); +static_assert(!is_std_array>); static_assert(!is_std_array); static_assert(is_same_type>), const bool>); static_assert(is_same_type&>), const bool>); +static_assert(is_std_vector>); +static_assert(!is_std_vector>); +static_assert(!is_std_vector>); +static_assert(!is_std_vector>); +static_assert(!is_std_vector); +static_assert(is_same_type>), const bool>); +static_assert(is_same_type&>), const bool>); + +static_assert(is_pmr_vector>); +static_assert(!is_pmr_vector>); +static_assert(!is_pmr_vector>); +static_assert(!is_pmr_vector>); +static_assert(!is_pmr_vector); +static_assert(is_same_type>), const bool>); +static_assert(is_same_type&>), const bool>); + static_assert(array_count> == 42); static_assert(array_count, 24>> == 24); static_assert(array_count, 24>&> == 24); @@ -352,15 +370,6 @@ static_assert(size_of static_assert(size_of, 24>, 8>>() == sizeof(uint32_t) * 42 * 24 * 8); static_assert(size_of, 24>, 8>&>() == sizeof(uint32_t) * 42 * 24 * 8); -// std_array fails on "negative subscript" -////static_assert(size_of>() == sizeof(uint8_t) * max_size_t); -////static_assert(size_of>() == sizeof(uint16_t) * max_size_t); - -// multiply overlow -////static_assert(size_of>() == sizeof(uint16_t) * to_half(max_size_t)); - -// TODO: This is not currently restricted (is_std_array || !is_std_array). - static_assert(is_uintx); static_assert(is_uintx); static_assert(is_uintx);