1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| template <typename T, bool U = __is_abstract(T)>
struct create_helper4 {
static T* create ();
};
template <typename T>
T* create_helper4<T, 0>::create(){
std::cout << "create on create_helper4 \n";
return new T();
}
template<typename T>
struct create_helper4<T, 1> {
static T* create();
};
template<typename T>
T* create_helper4<T, 1>::create() {
std::cout << "Cannot create and Abstract Base Class!\n";
std::cout << " Create failed on type_info::name() = "
<< typeid(T).name() << "\n";
return 0;
} |