mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
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:
@@ -733,5 +733,17 @@ TEST(TableTest, Merge) {
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
TEST(TableTest, Issue912) {
|
||||
Table({
|
||||
{"a"},
|
||||
});
|
||||
Table({
|
||||
{"a", "b"},
|
||||
});
|
||||
Table({
|
||||
{"a", "b", "c"},
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
Reference in New Issue
Block a user