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

Return std::array<std::string_view, 0> type for boost::pfr::names_as_array(empty_struct{}) (fixes #195)

This commit is contained in:
Antony Polukhin
2025-05-12 17:40:43 +03:00
parent b95fd86595
commit f004e91c9b
3 changed files with 14 additions and 18 deletions

View File

@@ -131,6 +131,13 @@ void test_names_as_array_for_empty() {
BOOST_TEST_EQ(value.empty(), true);
}
void test_names_as_array_iteration_for_empty() {
const auto names = boost::pfr::names_as_array<empty>();
for (std::string_view name : names) {
BOOST_ERROR("`names` must be empty");
}
}
} // namespace testing
int main() {
@@ -141,6 +148,7 @@ int main() {
testing::test_names_as_array();
testing::test_names_as_array_without_linkage();
testing::test_names_as_array_for_empty();
testing::test_names_as_array_iteration_for_empty();
return boost::report_errors();
}