mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Simplified definition of is_base_of
This commit is contained in:
parent
36a5b4ba16
commit
bce35c4927
@ -639,18 +639,13 @@ namespace etl
|
||||
struct is_base_of
|
||||
{
|
||||
private:
|
||||
|
||||
template<typename T> struct dummy {};
|
||||
struct internal: TDerived, dummy<int>{};
|
||||
|
||||
static TBase* check(TBase*) { return (TBase*)0; }
|
||||
|
||||
template<typename T>
|
||||
static char check(dummy<T>*) { return 0; }
|
||||
static char check(...) { return 0; }
|
||||
|
||||
public:
|
||||
|
||||
static const bool value = (sizeof(check((internal*)0)) == sizeof(TBase*));
|
||||
static const bool value = (sizeof(check((TDerived*)0)) == sizeof(TBase*));
|
||||
};
|
||||
|
||||
// For when TBase or TDerived is a fundamental type.
|
||||
|
||||
@ -627,18 +627,13 @@ namespace etl
|
||||
struct is_base_of
|
||||
{
|
||||
private:
|
||||
|
||||
template<typename T> struct dummy {};
|
||||
struct internal: TDerived, dummy<int>{};
|
||||
|
||||
static TBase* check(TBase*) { return (TBase*)0; }
|
||||
|
||||
template<typename T>
|
||||
static char check(dummy<T>*) { return 0; }
|
||||
static char check(...) { return 0; }
|
||||
|
||||
public:
|
||||
|
||||
static const bool value = (sizeof(check((internal*)0)) == sizeof(TBase*));
|
||||
static const bool value = (sizeof(check((TDerived*)0)) == sizeof(TBase*));
|
||||
};
|
||||
|
||||
// For when TBase or TDerived is a fundamental type.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user