auto performMainAxisLayout = [&] {
computeLogicalWidthForFlexItems(flexItems, lineRange, availableLogicalHorizontalSpace, flexRects);
distributeMarginAutoInMainAxis(flexItems, lineRange, availableLogicalHorizontalSpace, flexRects);
justifyFlexItems(flexItems, lineRange, availableLogicalHorizontalSpace, flexRects);
};
performMainAxisLayout();
auto performCrossAxisLayout = [&] {
auto availableLogicalVerticalSpace = lineHeightList[index];
computeLogicalHeightForFlexItems(flexItems, lineRange, availableLogicalVerticalSpace, flexRects);
distributeMarginAutoInCrossAxis(flexItems, lineRange, availableLogicalVerticalSpace, flexRects);
alignFlexItems(flexItems, lineRange, { lineTop, availableLogicalVerticalSpace }, flexRects);
lineTop += availableLogicalVerticalSpace;
};
performCrossAxisLayout();
This can be seen here[0] for more context. My question is - what is this [&] thing? And I cannot find the method named performMainAxisLayout() or performCrossAxisLayout() defined anywhere in the Layout class either. My assumption was that here, a structure/literal class is being built and the methods are on that class but the Layout class don't have them either.Where can I learn more about this syntax or modern C++ quick overview in general?
[0]. https://github.com/WebKit/WebKit/blob/main/Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp#L506-L536
EDIT: Fixed title typo.
Watch some of his videos on YouTube.