File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
include/boost/smart_ptr/detail Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,16 @@ template<class T> struct sp_type_identity
39
39
typedef T type;
40
40
};
41
41
42
+ // boost::type_with_alignment
43
+
44
+ template <std::size_t A> struct sp_type_with_alignment
45
+ {
46
+ struct alignas (A) type
47
+ {
48
+ unsigned char padding[ A ];
49
+ };
50
+ };
51
+
42
52
} // namespace detail
43
53
} // namespace boost
44
54
Original file line number Diff line number Diff line change @@ -428,3 +428,4 @@ run sp_move_only_deleter.cpp ;
428
428
run sp_is_bounded_array_test.cpp ;
429
429
run sp_is_unbounded_array_test.cpp ;
430
430
run sp_type_identity_test.cpp ;
431
+ run sp_type_with_alignment_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.hpp>
7
+
8
+ int main ()
9
+ {
10
+ using boost::detail::sp_type_with_alignment;
11
+
12
+ BOOST_TEST_EQ ( alignof ( sp_type_with_alignment<1 >::type ), 1 );
13
+ BOOST_TEST_EQ ( alignof ( sp_type_with_alignment<2 >::type ), 2 );
14
+ BOOST_TEST_EQ ( alignof ( sp_type_with_alignment<4 >::type ), 4 );
15
+ BOOST_TEST_EQ ( alignof ( sp_type_with_alignment<8 >::type ), 8 );
16
+
17
+ return boost::report_errors ();
18
+ }
You can’t perform that action at this time.
0 commit comments