Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-10-01 09:58:09

Alexander Nasonov wrote:
> Alexander Nasonov wrote:
>>I think it's possible to detect classes that have dtor with throw() spec.
>>The trick is based on a fact that implicitly declared dtor inherits
>>throw-spec from its bases and a fact that virtual dtor overrided in a
>>derived class can't have less restrictive throw-spec.
>>In this example, tester<T> can only be instantiated if T's dtor looks like
>>T::~T() throw(); otherwise, a compiler will complain. SFINAE can be
>>applied to get rid of compile error.
>>struct virtual_nothrow_dtor
>> virtual ~virtual_nothrow_dtor() throw();
>>template<class T>
>>struct tester : T, virtual_nothrow_dtor
>> // Implicitly defined dtor
> I'm trying to apply this technique
> but I can't. Is something wrong there?
> [snip]

SFINAE won't help, as it cannot be applied in your case. If
instantiation happens, it must succeed - no chance to get around this
AFAIK. SFINAE only works - as the name already suggests - for
substitutions, i.e. whether or not a type contains a sub-type.

Regards, Daniel

Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web:

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