|
Boost : |
From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-04-23 09:56:55
"David Abrahams" <david.abrahams_at_[hidden]> wrote in message
news:0ef801c1eac7$0af69c10$6501a8c0_at_boostconsulting.com...
> From: "Paul Mensonides" <pmenso57_at_[hidden]>
> > template<class T> class has_key_nested {
> > private:
> > template<class U> static small_t check(typename
U::nested*);
> > template<class U> static large_t check(...);
> > public:
> > static const bool value = sizeof(check<T>(0)) ==
> sizeof(small_t);
> > };
> >
> > Now that I look at it, 14.8.2/2 bullet 3, sub-bullet 3 appears to
say
> it is
> > legal, but I don't speak fluent ISO. :)
>
> Paul,
>
> It's legal, and I already used your trick to implement an is_class
which
> works on incomplete and noncopyable types with a conforming compiler
> (see the CVS).
This is a much simpler idiom than what I saw on clcm. That's great,
because it can have tons of cool applications.
Who invented it?
Andrei
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk