Boost logo

Boost :

From: Kevin Scarr (kscarr_at_[hidden])
Date: 2008-03-22 15:21:37

Marco Costalba wrote:
> So, I would like to ask you what exception type do you suggest could
> be suitable to throw in this case?

Interestingly, I looked at the std::exception classes as well when I saw
your earlier post and, I agree, there is nothing that leaps out as
directly appropriate.

I guess at a stretch you could use "invalid argument" since the null
pointer is caused by not having an operator defined with those
arguments, but it is a stretch and not very satisfying.

There is also "runtime error" which is so general as to require a note
in the overload document in big bold letters to explain why you are
using it. Again, not so satisfying.

Alternatively, you can derive your own exception from std::exception in
the overload namespace with a more descriptive type. Then you can put
some diagnostic information in the exception to help the programmer
track it down.

Such an exception is also catchable as a std::exception.


Boost list run by bdawes at, gregod at, cpdaniel at, john at