classShape
{
public:
Shape()
{
cout<<"Shape"<<endl;
}
};
struct__true_type{};
struct__false_type{};
template<class class_type>
struct__type_traits
{
typedef __true_type this_dummy_memeber;
typedef __false_type has_trivial_default_constructor;
typedef __false_type has_trivial_copy_constructor;
typedef __false_type has_trivial_assignment_operator;
typedef __false_type has_trivial_destructor;
typedef __false_type is_POD_type;
};
template<>struct __type_traits<Shape*>
{
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
template<class T>
inline void test(T& t)
{
return__test(t,&iterator_traits<T*>::value_type());//生成了一个临时对象
}
template<class T,class T1>
inline void __test(T& t,T1*)
{
typedef typename__type_traits<T1*>::is_POD_type is_POD;
return __test1(t,is_POD());
}
template<class T>
inline void __test1(T& t,__false_type)
{
cout<<"test_1_false_type"<<endl;
}
template<class T>
inline void __test1(T t,__true_type)
{
cout<<"test_1_true_type"<<endl;
}
intmain()
{
Shapea;
test(a);
return 0;
}