19 return [a = std::move(a), b = std::move(b)](
Element element) {
20 return b(a(std::move(element)));
40 return compose(std::move(a),
49 for (
auto& it : elements) {
50 output.push_back(std::move(it) | decorator);
69 return decorator(std::move(element));
96 box.x_max = fullsize.dimx;
97 box.y_max = fullsize.dimy;
101 const int max_iteration = 20;
102 while (status.need_iteration && status.iteration < max_iteration) {
103 e->ComputeRequirement();
106 box.x_max = std::min(box.x_max, e->requirement().min_x);
107 box.y_max = std::min(box.y_max, e->requirement().min_y);
110 status.need_iteration =
false;
114 if (!status.need_iteration) {
119 box.x_max = std::min(e->requirement().min_x, fullsize.dimx);
120 box.y_max = std::min(e->requirement().min_y, fullsize.dimy);
132 class Impl :
public Node {
133 void ComputeRequirement()
override {
134 requirement_.min_x = 0;
135 requirement_.min_y = 0;
138 return std::make_unique<Impl>();
Dimensions Fit(Element &)
std::function< Element(Element)> Decorator
Element nothing(Element element)
A decoration doing absolutely nothing.
std::shared_ptr< Node > Element
std::vector< Element > Elements
Component operator|(Component component, ComponentDecorator decorator)
Component & operator|=(Component &component, ComponentDecorator decorator)