diff --git a/include/boost/smart_ptr/detail/sp_type_traits.hpp b/include/boost/smart_ptr/detail/sp_type_traits.hpp index 1437c7b..6e0dcee 100644 --- a/include/boost/smart_ptr/detail/sp_type_traits.hpp +++ b/include/boost/smart_ptr/detail/sp_type_traits.hpp @@ -22,6 +22,16 @@ template struct sp_is_bounded_array< T[N] >: std::true_t { }; +// std::is_unbounded_array (C++20) + +template struct sp_is_unbounded_array: std::false_type +{ +}; + +template struct sp_is_unbounded_array< T[] >: std::true_type +{ +}; + } // namespace detail } // namespace boost diff --git a/test/Jamfile b/test/Jamfile index 3de1ebc..8c67901 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -426,3 +426,4 @@ run sp_unique_ptr_test2.cpp ; run sp_move_only_deleter.cpp ; run sp_is_bounded_array_test.cpp ; +run sp_is_unbounded_array_test.cpp ; diff --git a/test/sp_is_unbounded_array_test.cpp b/test/sp_is_unbounded_array_test.cpp new file mode 100644 index 0000000..f929e4e --- /dev/null +++ b/test/sp_is_unbounded_array_test.cpp @@ -0,0 +1,27 @@ +// Copyright 2024 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include + +struct X; + +int main() +{ + using boost::detail::sp_is_unbounded_array; + + BOOST_TEST_TRAIT_FALSE(( sp_is_unbounded_array )); + BOOST_TEST_TRAIT_FALSE(( sp_is_unbounded_array )); + BOOST_TEST_TRAIT_FALSE(( sp_is_unbounded_array )); + + BOOST_TEST_TRAIT_TRUE(( sp_is_unbounded_array )); + BOOST_TEST_TRAIT_TRUE(( sp_is_unbounded_array )); + + BOOST_TEST_TRAIT_FALSE(( sp_is_unbounded_array )); + BOOST_TEST_TRAIT_FALSE(( sp_is_unbounded_array )); + BOOST_TEST_TRAIT_FALSE(( sp_is_unbounded_array )); + BOOST_TEST_TRAIT_FALSE(( sp_is_unbounded_array )); + + return boost::report_errors(); +}