What causes std::bad_function_call?

后端 未结 4 538
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-30 19:41

I\'ve seen a few questions that refer to the std::bad_function_call exception, but haven\'t been able to find out any by Googling about what causes this exception.

W

4条回答
  •  太阳男子
    2020-12-30 20:01

    Sure- the easiest is where you try to call a std::function that's empty.

    int main() {
        std::function intfunc;
        int x = intfunc(); // BAD
    }
    

提交回复
热议问题