mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-19 04:22:13 +00:00
committed by
GitHub
parent
674f3723c5
commit
b5e523f2b3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user