Table of Contents

Generated methods (llmcpp)

Generated methods implement prose requests within a real C++ class interface. The inventory example asks for a state transition with an explicit failure case:

__llm__ bool Inventory::reserve(unsigned count)
{
    If enough stock is available, move count units from available to reserved
    and return true. Otherwise leave the inventory unchanged and return false.
}

Inventory declares private m_available and m_reserved fields. Because this is a member function, compiler context lets the agent inspect and use that state under normal access rules.

The return type and count parameter remain C++. Only the statements are generated. Candidate compilation checks access and types; behavioral tests should check that a failed reservation leaves both counters unchanged. This distinction matters because code can compile while breaking the requested state invariant.

Source: 07_inventory.cpp.