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.
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?
"Performing a function call without having a target to call throws an exception of type std::bad_function_call"
No credits to me....its Nicolai Josuttis Pundit of C++ Standard Lib
Sure- the easiest is where you try to call a
std::function
that's empty.in my case was the problem was in capture list. i have a recursive lambda function.
missing & from f_build in capture list generate a bad call.
Call of a temporary function also can throw:
But this depend on compiler (vc++ throws, g++ not).