File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
include/boost/smart_ptr/detail Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ #ifndef BOOST_SMART_PTR_DETAIL_SP_TYPE_TRAITS_HPP_INCLUDED
2
+ #define BOOST_SMART_PTR_DETAIL_SP_TYPE_TRAITS_HPP_INCLUDED
3
+
4
+ // Copyright 2024 Peter Dimov
5
+ // Distributed under the Boost Software License, Version 1.0.
6
+ // https://www.boost.org/LICENSE_1_0.txt
7
+
8
+ #include < type_traits>
9
+
10
+ namespace boost
11
+ {
12
+ namespace detail
13
+ {
14
+
15
+ // std::is_bounded_array (C++20)
16
+
17
+ template <class T > struct sp_is_bounded_array : std::false_type
18
+ {
19
+ };
20
+
21
+ template <class T , std::size_t N> struct sp_is_bounded_array < T[N] >: std::true_type
22
+ {
23
+ };
24
+
25
+ } // namespace detail
26
+ } // namespace boost
27
+
28
+ #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_TYPE_TRAITS_HPP_INCLUDED
Original file line number Diff line number Diff line change @@ -424,3 +424,5 @@ run sp_unordered_test.cpp ;
424
424
425
425
run sp_unique_ptr_test2.cpp ;
426
426
run sp_move_only_deleter.cpp ;
427
+
428
+ run sp_is_bounded_array_test.cpp ;
Original file line number Diff line number Diff line change
1
+ // Copyright 2024 Peter Dimov
2
+ // Distributed under the Boost Software License, Version 1.0.
3
+ // https://www.boost.org/LICENSE_1_0.txt
4
+
5
+ #include < boost/smart_ptr/detail/sp_type_traits.hpp>
6
+ #include < boost/core/lightweight_test_trait.hpp>
7
+
8
+ struct X ;
9
+
10
+ int main ()
11
+ {
12
+ using boost::detail::sp_is_bounded_array;
13
+
14
+ BOOST_TEST_TRAIT_FALSE (( sp_is_bounded_array<void > ));
15
+ BOOST_TEST_TRAIT_FALSE (( sp_is_bounded_array<int > ));
16
+ BOOST_TEST_TRAIT_FALSE (( sp_is_bounded_array<X> ));
17
+
18
+ BOOST_TEST_TRAIT_FALSE (( sp_is_bounded_array<int []> ));
19
+ BOOST_TEST_TRAIT_FALSE (( sp_is_bounded_array<X[]> ));
20
+
21
+ BOOST_TEST_TRAIT_TRUE (( sp_is_bounded_array<int [1 ]> ));
22
+ BOOST_TEST_TRAIT_TRUE (( sp_is_bounded_array<int [7 ]> ));
23
+ BOOST_TEST_TRAIT_TRUE (( sp_is_bounded_array<X[1 ]> ));
24
+ BOOST_TEST_TRAIT_TRUE (( sp_is_bounded_array<X[7 ]> ));
25
+
26
+ return boost::report_errors ();
27
+ }
You can’t perform that action at this time.
0 commit comments