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.
std::bad_function_call
What kind of behavior is supposed to cause this exception? Can you give me minimal examples that don't have other semantic problems also going on?
Sure- the easiest is where you try to call a std::function that's empty.
std::function
int main() { std::function<int()> intfunc; int x = intfunc(); // BAD }
1.4m articles
1.4m replys
5 comments
57.0k users