mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-19 10:08:10 +08:00
Use shared_ptr instead of unique_ptr for elements.
This allow users to pass it into initializer list. Then clang-format will produce 'acceptable' indentations. This fixes: https://github.com/ArthurSonzogni/FTXUI/issues/18
This commit is contained in:
@@ -105,17 +105,17 @@ class Border : public Node {
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<Node> border(Element child) {
|
||||
return std::make_unique<Border>(unpack(std::move(child)));
|
||||
Element border(Element child) {
|
||||
return std::make_shared<Border>(unpack(std::move(child)));
|
||||
}
|
||||
|
||||
std::unique_ptr<Node> window(Element title, Element content) {
|
||||
return std::make_unique<Border>(unpack(std::move(content), std::move(title)));
|
||||
Element window(Element title, Element content) {
|
||||
return std::make_shared<Border>(unpack(std::move(content), std::move(title)));
|
||||
}
|
||||
|
||||
Decorator borderWith(Pixel pixel) {
|
||||
return [pixel](Element child) {
|
||||
return std::make_unique<Border>(unpack(std::move(child)), pixel);
|
||||
return std::make_shared<Border>(unpack(std::move(child)), pixel);
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user