相关疑难解决方法(0)

C ++强制堆栈在函数内部展开

我正在学习C ++,目前正在摆弄以下代码:

class Bar;
struct Callback {
    virtual void Continue(Bar&) = 0;
};

// ...

void Foo(Bar& _x, Callback& result)
{
    // Do stuff with _x

    if(/* some condition */) {
        // TODO: Force unwind of stack
        result.Continue(_x);
        return;
    }

    // Do more stuff with _x

    if(/* some other condition */) {
        // TODO: Force unwind of stack
        result.Continue(_x);
        return;
    }

    // TODO: Force unwind of stack
    Bar y; // allocate something on the stack
    result.Continue(y);
}
Run Code Online (Sandbox Code Playgroud)

主要思想是,我知道在每个站点都result.Continue被调用时,该函数 …

c++ stack-overflow continuations stack

1
推荐指数
1
解决办法
1671
查看次数

标签 统计

c++ ×1

continuations ×1

stack ×1

stack-overflow ×1