Table: support initializer list constructor. (#915)

To avoid burdening the user with explicit type construction when using
the library, we can use a constructor that accepts an initializer list
(std::initializer_list). This allows users to pass initializer lists
directly without having to wrap them in
std::vector<std::vector<std::string>>. This resolves the ambiguous case
when the inner list contains only two elements.

Bug:https://github.com/ArthurSonzogni/FTXUI/issues/912
This commit is contained in:
Arthur Sonzogni
2024-08-13 15:55:09 +02:00
committed by GitHub
parent d7de24cd9e
commit fcd050c017
3 changed files with 29 additions and 0 deletions

View File

@@ -733,5 +733,17 @@ TEST(TableTest, Merge) {
screen.ToString());
}
TEST(TableTest, Issue912) {
Table({
{"a"},
});
Table({
{"a", "b"},
});
Table({
{"a", "b", "c"},
});
}
} // namespace ftxui
// NOLINTEND