]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/meta/convertible.h | |
3 | // Purpose: Test if types are convertible | |
4 | // Author: Arne Steinarson | |
5 | // Created: 2008-01-10 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2008 Arne Steinarson | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_META_CONVERTIBLE_H_ | |
12 | #define _WX_META_CONVERTIBLE_H_ | |
13 | ||
14 | // Helper to decide if an object of type D is convertible to type B (the test | |
15 | // succeeds in particular when D derives from B) | |
16 | template <class D, class B> | |
17 | struct wxConvertibleTo | |
18 | { | |
19 | static char Match(B* pb); | |
20 | static int Match(...); | |
21 | ||
22 | enum { value = sizeof(Match(static_cast<D*>(NULL))) == sizeof(char) }; | |
23 | }; | |
24 | ||
25 | #endif // _WX_META_CONVERTIBLE_H_ | |
26 |