
On Sat, Mar 22, 2008 at 7:18 PM, Kevin Scarr <kscarr@iinet.net.au> wrote:
Marco Costalba wrote:
It comes much more naturally to me to think at this:
if (ptr) ptr->doSomething();
Ok. This usage is fine with me. I guess I just hadn't seen the overload<> as being a declaration of an object with pointer behaviour.
If that is what it is, then I would prefer the usage above.
Thanks for the clarification,
I'm browsing standard exceptions but I fail to see something suitable in this case. A little of background: when you call an overload with some arguments, as example f(7); According to the arguments type and arity a specific operator() of the overload class is called by the compiler. This operator() mainly dereferences the content of an auto_ptr that points to a functor wrapper that does the job. If no function as been already assigned then auto_ptr is empty and is here the a segfault occurs, when you try to dereference it's content. So, I would like to ask you what exception type do you suggest could be suitable to throw in this case? Thanks Marco