
On Sun, Oct 24, 2010 at 1:17 AM, Edward Diener <eldiener@tropicsoft.com> wrote:
On 10/23/2010 5:30 PM, Domagoj Saric wrote:
[snip]
I meant simply what I said. Please explain to me why boost::function throwing an exception when invoked on an empty target is objectionable to you. If I have misunderstand to what you are objecting I apologize, but it seems to me that you find this behavior incorrect somehow.
The question is not directed at me, but I feel compelled to answer it. I do find it incorrect to throw when invoked on an empty target because I feel that this should be a contract for operator() and contracts should be checked with asserts, which make it easier for debugging and have no overhead (RTTI or otherwise) when compiled with NDEBUG.
In reading the documentation it clearly states:
"boost::bad_function_call — An exception type thrown when an instance of a function object is empty when invoked."
Unfortunately, breaking changes are very complicated to get in. Regards, -- Felipe Magno de Almeida