2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-19 04:22:13 +00:00

Merge remote-tracking branch 'origin/develop' into feature/get_name

This commit is contained in:
denzor200
2023-08-12 11:59:31 +00:00
6 changed files with 37 additions and 13 deletions

View File

@@ -56,6 +56,21 @@ struct simple {
struct empty{};
#if BOOST_PFR_USE_CPP17
constexpr std::size_t get_field_count_through_for_each_field() {
std::size_t counter = 0;
boost::pfr::for_each_field(simple{}, [&counter](auto&& /*val*/, std::size_t /*i*/) {
++ counter;
});
return counter;
}
// MSVC-14.1 fails to compile the following code
#if !defined(_MSC_VER) || _MSC_VER > 1916
static_assert(3 == get_field_count_through_for_each_field());
#endif
#endif
int main () {
std::size_t control = 0;

View File

@@ -18,7 +18,11 @@ struct X {
struct S { X x0; X x1; int x2; X x3; };
int main() {
#if BOOST_PFR_HAS_GUARANTEED_COPY_ELISION
// MSVC-14.3 fails this test
#if !defined(_MSC_VER) || _MSC_VER < 1930 || _MSC_VER > 1939
static_assert(boost::pfr::tuple_size_v<S> == 4, "");
struct S5_0 { int x0; int x1; int x2; int x3; X x4; };
@@ -38,6 +42,8 @@ int main() {
struct S6 { X x0; X x1; X x2; X x3; X x4; X x5;};
static_assert(boost::pfr::tuple_size_v<S6> == 6, "");
#endif
#endif // #if BOOST_PFR_HAS_GUARANTEED_COPY_ELISION
return boost::report_errors();