更新文件
This commit is contained in:
@@ -78,6 +78,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="TypeTraits.h" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|||||||
@@ -19,4 +19,9 @@
|
|||||||
<Filter>源文件</Filter>
|
<Filter>源文件</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="TypeTraits.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -2,241 +2,240 @@
|
|||||||
#define _TYPE_TRAITS_H_
|
#define _TYPE_TRAITS_H_
|
||||||
|
|
||||||
namespace TinySTL{
|
namespace TinySTL{
|
||||||
namespace zstd
|
|
||||||
|
struct _true_type { };
|
||||||
|
struct _false_type { };
|
||||||
|
|
||||||
|
/*
|
||||||
|
** <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
*/
|
||||||
|
template<class T>
|
||||||
|
struct _type_traits
|
||||||
{
|
{
|
||||||
struct _true_type { };
|
typedef _false_type has_trivial_default_constructor;
|
||||||
struct _false_type { };
|
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<>
|
||||||
** <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>T<EFBFBD><54><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
struct _type_traits<bool>
|
||||||
*/
|
{
|
||||||
template<class T>
|
typedef _true_type has_trivial_default_constructor;
|
||||||
struct _type_traits
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
{
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _false_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _false_type has_trivial_copy_constructor;
|
typedef _true_type is_POD_type;
|
||||||
typedef _false_type has_trivial_assignment_operator;
|
};
|
||||||
typedef _false_type has_trivial_destructor;
|
template<>
|
||||||
typedef _false_type is_POD_type;
|
struct _type_traits<char>
|
||||||
};
|
{
|
||||||
|
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<unsigned char>
|
||||||
|
{
|
||||||
|
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<signed char>
|
||||||
|
{
|
||||||
|
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<wchar_t>
|
||||||
|
{
|
||||||
|
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<short>
|
||||||
|
{
|
||||||
|
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<unsigned short>
|
||||||
|
{
|
||||||
|
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<int>
|
||||||
|
{
|
||||||
|
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<unsigned int>
|
||||||
|
{
|
||||||
|
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<long>
|
||||||
|
{
|
||||||
|
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<unsigned long>
|
||||||
|
{
|
||||||
|
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<long long>
|
||||||
|
{
|
||||||
|
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<unsigned long long>
|
||||||
|
{
|
||||||
|
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<float>
|
||||||
|
{
|
||||||
|
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<double>
|
||||||
|
{
|
||||||
|
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<long double>
|
||||||
|
{
|
||||||
|
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<>
|
template<class T>
|
||||||
struct _type_traits<bool>
|
struct _type_traits<T*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
template<class T>
|
||||||
struct _type_traits<char>
|
struct _type_traits<const T*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct _type_traits<unsigned char>
|
struct _type_traits<char*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct _type_traits<signed char>
|
struct _type_traits<unsigned char*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct _type_traits<wchar_t>
|
struct _type_traits<signed char*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct _type_traits<short>
|
struct _type_traits<const char*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct _type_traits<unsigned short>
|
struct _type_traits<const unsigned char*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct _type_traits<int>
|
struct _type_traits<const signed char*>
|
||||||
{
|
{
|
||||||
typedef _true_type has_trivial_default_constructor;
|
typedef _true_type has_trivial_default_constructor;
|
||||||
typedef _true_type has_trivial_copy_constructor;
|
typedef _true_type has_trivial_copy_constructor;
|
||||||
typedef _true_type has_trivial_assignment_operator;
|
typedef _true_type has_trivial_assignment_operator;
|
||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
template<>
|
|
||||||
struct _type_traits<unsigned int>
|
|
||||||
{
|
|
||||||
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<long>
|
|
||||||
{
|
|
||||||
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<unsigned long>
|
|
||||||
{
|
|
||||||
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<long long>
|
|
||||||
{
|
|
||||||
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<unsigned long long>
|
|
||||||
{
|
|
||||||
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<float>
|
|
||||||
{
|
|
||||||
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<double>
|
|
||||||
{
|
|
||||||
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<long double>
|
|
||||||
{
|
|
||||||
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>
|
|
||||||
struct _type_traits<T*>
|
|
||||||
{
|
|
||||||
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>
|
|
||||||
struct _type_traits<const T*>
|
|
||||||
{
|
|
||||||
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<char*>
|
|
||||||
{
|
|
||||||
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<unsigned char*>
|
|
||||||
{
|
|
||||||
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<signed char*>
|
|
||||||
{
|
|
||||||
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<const char*>
|
|
||||||
{
|
|
||||||
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<const unsigned char*>
|
|
||||||
{
|
|
||||||
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<const signed char*>
|
|
||||||
{
|
|
||||||
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
|
#endif
|
||||||
Reference in New Issue
Block a user