Struct Step¶
Defined in File ordered_schedule.hpp
Struct Documentation¶
-
struct Step¶
One ordered step of a
ScopeBlock:build a value at this scope, or enter a nested child loop block.The design brief’s target shape is a bare alias,
usingStep = std::variant<BuildStep, ScopeBlock>. That is not directly expressible:ScopeBlock::stepsmust hold a sequence ofStep(so a build interleaves with child blocks in one ordered list, per the class doc above), which meansStephas to be at least forward-declared beforeScopeBlock; butstd::variantrequires every alternative type complete at the point the variant specialization is instantiated (unlikecontainer::vector/std::vector, which the C++17 library tolerates holding an incomplete element type up to first use — the same relaxationScopeBlock::stepsitself relies on for its self-reference). A bareusingStep = std::variant<BuildStep, ScopeBlock> declared beforeScopeBlocktherefore cannot compile (ScopeBlockincomplete there), and a type alias cannot be forward-declared separately from its definition (no “using Step;” forward declaration exists in C++) to defer it to afterScopeBlockeither.Hence
Stepis a real (forward-declarable) class wrapping the variant, not a bare alias:ScopeBlock::stepsholdscontainer::vector<Step>whileStepis still only forward-declared (legal, per thestd::vectorincomplete-type allowance above), andStep'sown definition (with the variant member) followsScopeBlock, whereScopeBlockis by then complete. This preserves the single ordered sequence of interleaved build/child-block steps the design requires, and preserves realstd::variantsemantics (std::holds_alternative/std::get_if/std::visitall work onStep::value) — the only change from the brief’s literal shape is the one extra wrapping layer forced by the forward-declaration ordering.Public Members
-
std::variant<BuildStep, ScopeBlock> value¶
-
std::variant<BuildStep, ScopeBlock> value¶