How is argument from function passed as a class ctor value

62 views Asked by At

In the code below, how is max_dishes_on_table being used in seastar::coroutine::experimental::generator? It is not referenced anywhere, or passed anywhere. And yet, it is used by the generator.

seastar::coroutine::experimental::generator<Dish, seastar::circular_buffer>
make_dishes(coroutine::experimental::buffer_size_t max_dishes_on_table,
            Ingredients&& ingredients) {
    while (ingredients) {
        auto some_ingredients = ingredients.alloc();
        auto preprocessed = co_await prepare_ingredients(std::move(some_ingredients));
        co_yield co_await cook_a_dish(std::move(preprocessed));
    }
}
0

There are 0 answers