| 1 |
// file : cutl/meta/polymorphic-p.hxx |
| 2 |
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC |
| 3 |
// license : MIT; see accompanying LICENSE file |
| 4 |
|
| 5 |
#ifndef CUTL_META_POLYMORPHIC_HXX |
| 6 |
#define CUTL_META_POLYMORPHIC_HXX |
| 7 |
|
| 8 |
#include <cutl/meta/class-p.hxx> |
| 9 |
#include <cutl/meta/remove-cv.hxx> |
| 10 |
|
| 11 |
namespace cutl |
| 12 |
{ |
| 13 |
namespace meta |
| 14 |
{ |
| 15 |
template <typename CVX> |
| 16 |
struct polymorphic_p |
| 17 |
{ |
| 18 |
typedef typename remove_cv<CVX>::r X; |
| 19 |
|
| 20 |
template <typename Y, bool C> |
| 21 |
struct impl |
| 22 |
{ |
| 23 |
static const bool r = false; |
| 24 |
}; |
| 25 |
|
| 26 |
template <typename Y> |
| 27 |
struct impl<Y, true> |
| 28 |
{ |
| 29 |
struct t1: Y |
| 30 |
{ |
| 31 |
t1 (); |
| 32 |
}; |
| 33 |
|
| 34 |
struct t2: Y |
| 35 |
{ |
| 36 |
t2 (); |
| 37 |
|
| 38 |
virtual |
| 39 |
~t2 () throw (); |
| 40 |
}; |
| 41 |
|
| 42 |
static const bool r = sizeof (t1) == sizeof (t2); |
| 43 |
}; |
| 44 |
|
| 45 |
static const bool r = impl<X, class_p<X>::r>::r; |
| 46 |
}; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
#endif // CUTL_META_POLYMORPHIC_HXX |