diff --git a/TinySTL/TypeTraits.h b/TinySTL/TypeTraits.h new file mode 100644 index 0000000..342f59a --- /dev/null +++ b/TinySTL/TypeTraits.h @@ -0,0 +1,242 @@ +#ifndef _TYPE_TRAITS_H_ +#define _TYPE_TRAITS_H_ + +namespace TinySTL{ + namespace zstd + { + struct _true_type { }; + struct _false_type { }; + + /* + ** 萃取传入的T类型的类型特性 + */ + template + struct _type_traits + { + 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 + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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 + struct _type_traits + { + 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 + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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<> + struct _type_traits + { + 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; + }; +} + +#endif \ No newline at end of file