| 1 | // Copyright (c) 2018-2024 Antony Polukhin |
| 2 | // |
| 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #include <boost/pfr/tuple_size.hpp> |
| 7 | |
| 8 | #include <boost/core/lightweight_test.hpp> |
| 9 | |
| 10 | struct X { |
| 11 | X() = default; |
| 12 | X(X&&) = default; |
| 13 | X(const X&) = delete; |
| 14 | |
| 15 | X& operator=(X&&) = default; |
| 16 | X& operator=(const X&) = delete; |
| 17 | }; |
| 18 | struct S { X x0; X x1; int x2; X x3; }; |
| 19 | |
| 20 | int main() { |
| 21 | static_assert(boost::pfr::tuple_size_v<S> == 4, "" ); |
| 22 | |
| 23 | struct S5_0 { int x0; int x1; int x2; int x3; X x4; }; |
| 24 | static_assert(boost::pfr::tuple_size_v<S5_0> == 5, "" ); |
| 25 | |
| 26 | struct S5_1 { X x0; int x1; int x2; int x3; int x4; }; |
| 27 | static_assert(boost::pfr::tuple_size_v<S5_1> == 5, "" ); |
| 28 | |
| 29 | struct S5_2 { int x0; int x1; X x2; int x3; int x4; }; |
| 30 | static_assert(boost::pfr::tuple_size_v<S5_2> == 5, "" ); |
| 31 | |
| 32 | struct S5_3 { int x0; int x1; X x2; int x3; X x4; }; |
| 33 | static_assert(boost::pfr::tuple_size_v<S5_3> == 5, "" ); |
| 34 | |
| 35 | struct S5_4 { X x0; X x1; X x2; X x3; X x4; }; |
| 36 | static_assert(boost::pfr::tuple_size_v<S5_4> == 5, "" ); |
| 37 | |
| 38 | struct S6 { X x0; X x1; X x2; X x3; X x4; X x5;}; |
| 39 | static_assert(boost::pfr::tuple_size_v<S6> == 6, "" ); |
| 40 | |
| 41 | return boost::report_errors(); |
| 42 | } |
| 43 | |
| 44 | |