18 return [a = std::move(a), b = std::move(b)](
Element element) {
19 return b(a(std::move(element)));
39 return compose(std::move(a),
48 for (
auto& it : elements) {
49 output.push_back(std::move(it) | decorator);
68 return decorator(std::move(element));
95 box.x_max = fullsize.dimx;
96 box.y_max = fullsize.dimy;
100 const int max_iteration = 20;
101 while (status.need_iteration && status.iteration < max_iteration) {
102 e->ComputeRequirement();
105 box.x_max = std::min(box.x_max, e->requirement().min_x);
106 box.y_max = std::min(box.y_max, e->requirement().min_y);
109 status.need_iteration =
false;
113 if (!status.need_iteration) {
118 box.x_max = std::min(e->requirement().min_x, fullsize.dimx);
119 box.y_max = std::min(e->requirement().min_y, fullsize.dimy);
131 class Impl :
public Node {
132 void ComputeRequirement()
override {
133 requirement_.min_x = 0;
134 requirement_.min_x = 0;
137 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)