Hi Peter,
The actual throwing is done by using X<void>::throw_bad_alloc. The
helper template is only necessary to give the correct "linkage" to
throw_bad_alloc so that multiple definitions do not result in an
error.
A compiled library that wishes to be "exception neutral" (such as
libstdc++ itself) should #define _EXCEPTION_NEUTRAL and would receive
no definition of throw_bad_alloc, leaving the calls unresolved.
User code just #includes the above header (indirectly via any
libstdc++ include) and receives an appropriate (for the current
__EXCEPTIONS setting) definition for X<void>::throw_bad_alloc because
of the explicit instantiation.
I'm trying to catch up on this (after a few days spent on something
completely different...)
First, thanks of course both to you and Howard for the interesting
feedback.
Peter, at the moment, I have trouble understanding what you are
suggesting specifically for libsupc++, for things like operator new...