|
Boost : |
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-04-15 03:26:58
Rainer Deyke wrote:
> It might be possible to provide a default handler and allow the user to
> override it. Something like this:
>
> // In boost header:
> template<class T> void assertion_handler(T) {}
> void f(int *p)
> {
> if (!p) assertion_handler(1);
> }
>
> // In user code:
> void assertion_handler(int)
> {
> std::cerr << "Assertion failed." << std::endl;
> }
I believe that this does not work, because the function f() always calls
the template function assertion_handler, because a declaration for the
non-template overload is not visible at f().
Jens Maurer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk