From 4a438269e59b35fa2d2746748e9943dec4727031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Wed, 17 Sep 2014 08:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0TypeTraits=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/TypeTraits.h | 242 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 TinySTL/TypeTraits.h 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