From: Alexander Nasonov (alnsn-mycop_at_[hidden])
Date: 2003-10-01 09:54:43
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?
template<class T, int>
typedef T type;
template<class T, class = T>
static const bool value = false;
typename type_fwd<T, sizeof(new tester<T>) >::type
static const bool value = true;
-- Alexander Nasonov Remove minus and all between minus and at from my e-mail for timely response
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk