/*
Copyright © 2010 yan Verdavaine
This file is part of QExtend.
QExtend is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
QExtend is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QExtend. If not, see .
*/
#ifndef QEXTEND_TEMPLATETOOLS_H
#define QEXTEND_TEMPLATETOOLS_H
namespace QExtend
{
template
class IsDerivedFrom
{
//internal dev not cocumented
class No { };
class Yes { No no[3]; };
static Yes Test( B* ); // declared, but not defined
static No Test( ... ); // declared, but not defined
public:
//
static const bool val = sizeof(Test(static_cast(0))) == sizeof(Yes);
};
template
class has_hello {
class No { };
class Yes { No no[3]; };
template struct type_check;
template static Yes Test(type_check*);
template static No Test (...);
public :
static const bool val = sizeof(Test(0)) == sizeof(Yes);
};
template
class has_hello2 {
class No { };
class Yes { No no[3]; };
template struct type_check;
template static Yes Test(type_check*);
template static Yes Test(type_check*);
template static No Test (...);
public :
static const bool val = sizeof(Test(0)) == sizeof(Yes);
};
}
#endif