]> git.saurik.com Git - wxWidgets.git/blame - include/wx/meta/convertible.h
Implement SelectAll for OSX WebKit.
[wxWidgets.git] / include / wx / meta / convertible.h
CommitLineData
0fb0ecc4
VZ
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
4f927337
VS
11#ifndef _WX_META_CONVERTIBLE_H_
12#define _WX_META_CONVERTIBLE_H_
0fb0ecc4 13
0503f19c
VZ
14//
15// Introduce an extra class to make this header compilable with g++3.2
16//
17template <class D, class B>
18struct wxConvertibleTo_SizeHelper
19{
03647350
VZ
20 static char Match(B* pb);
21 static int Match(...);
0503f19c
VZ
22};
23
0fb0ecc4
VZ
24// Helper to decide if an object of type D is convertible to type B (the test
25// succeeds in particular when D derives from B)
26template <class D, class B>
27struct wxConvertibleTo
28{
03647350
VZ
29 enum
30 {
31 value =
32 sizeof(wxConvertibleTo_SizeHelper<D,B>::Match(static_cast<D*>(NULL)))
33 ==
34 sizeof(char)
35 };
0fb0ecc4
VZ
36};
37
4f927337 38#endif // _WX_META_CONVERTIBLE_H_
0fb0ecc4 39