add
This commit is contained in:
13
TinySTL/Test/TypeTraitsTest.cpp
Normal file
13
TinySTL/Test/TypeTraitsTest.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include "TypeTraitsTest.h"
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
namespace TinySTL{
|
||||||
|
namespace TypeTraitsTest{
|
||||||
|
void testCase1(){
|
||||||
|
}
|
||||||
|
|
||||||
|
void testAllCases(){
|
||||||
|
testCase1();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
TinySTL/Test/TypeTraitsTest.h
Normal file
12
TinySTL/Test/TypeTraitsTest.h
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef _TYPE_TRAITS_TEST_H_
|
||||||
|
#define _TYPE_TRAITS_TEST_H_
|
||||||
|
|
||||||
|
#include "../TypeTraits.h"
|
||||||
|
|
||||||
|
namespace TinySTL{
|
||||||
|
namespace TypeTraitsTest{
|
||||||
|
void testAllCases();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -103,6 +103,7 @@
|
|||||||
<ClCompile Include="Test\StringTest.cpp" />
|
<ClCompile Include="Test\StringTest.cpp" />
|
||||||
<ClCompile Include="Test\SuffixArrayTest.cpp" />
|
<ClCompile Include="Test\SuffixArrayTest.cpp" />
|
||||||
<ClCompile Include="Test\TrieTreeTest.cpp" />
|
<ClCompile Include="Test\TrieTreeTest.cpp" />
|
||||||
|
<ClCompile Include="Test\TypeTraitsTest.cpp" />
|
||||||
<ClCompile Include="Test\UFSetTest.cpp" />
|
<ClCompile Include="Test\UFSetTest.cpp" />
|
||||||
<ClCompile Include="Test\UniquePtrTest.cpp" />
|
<ClCompile Include="Test\UniquePtrTest.cpp" />
|
||||||
<ClCompile Include="Test\Unordered_setTest.cpp" />
|
<ClCompile Include="Test\Unordered_setTest.cpp" />
|
||||||
@@ -160,6 +161,7 @@
|
|||||||
<ClInclude Include="Test\SuffixArrayTest.h" />
|
<ClInclude Include="Test\SuffixArrayTest.h" />
|
||||||
<ClInclude Include="Test\TestUtil.h" />
|
<ClInclude Include="Test\TestUtil.h" />
|
||||||
<ClInclude Include="Test\TrieTreeTest.h" />
|
<ClInclude Include="Test\TrieTreeTest.h" />
|
||||||
|
<ClInclude Include="Test\TypeTraitsTest.h" />
|
||||||
<ClInclude Include="Test\UFSetTest.h" />
|
<ClInclude Include="Test\UFSetTest.h" />
|
||||||
<ClInclude Include="Test\UniquePtrTest.h" />
|
<ClInclude Include="Test\UniquePtrTest.h" />
|
||||||
<ClInclude Include="Test\Unordered_setTest.h" />
|
<ClInclude Include="Test\Unordered_setTest.h" />
|
||||||
|
|||||||
@@ -111,6 +111,9 @@
|
|||||||
<ClCompile Include="Test\UFSetTest.cpp">
|
<ClCompile Include="Test\UFSetTest.cpp">
|
||||||
<Filter>Test</Filter>
|
<Filter>Test</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Test\TypeTraitsTest.cpp">
|
||||||
|
<Filter>Test</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="TypeTraits.h">
|
<ClInclude Include="TypeTraits.h">
|
||||||
@@ -299,6 +302,9 @@
|
|||||||
<ClInclude Include="UFSet.h">
|
<ClInclude Include="UFSet.h">
|
||||||
<Filter>头文件</Filter>
|
<Filter>头文件</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Test\TypeTraitsTest.h">
|
||||||
|
<Filter>Test</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\README.md" />
|
<None Include="..\README.md" />
|
||||||
|
|||||||
@@ -3,6 +3,19 @@
|
|||||||
|
|
||||||
namespace TinySTL{
|
namespace TinySTL{
|
||||||
|
|
||||||
|
namespace{
|
||||||
|
template<bool, class Ta, class Tb>
|
||||||
|
struct IfThenElse;
|
||||||
|
template<class Ta, class Tb>
|
||||||
|
struct IfThenElse < true, Ta, Tb > {
|
||||||
|
using result = Ta;
|
||||||
|
};
|
||||||
|
template<class Ta, class Tb>
|
||||||
|
struct IfThenElse < false, Ta, Tb > {
|
||||||
|
using result = Tb;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
struct _true_type { };
|
struct _true_type { };
|
||||||
struct _false_type { };
|
struct _false_type { };
|
||||||
|
|
||||||
@@ -236,6 +249,6 @@ namespace TinySTL{
|
|||||||
typedef _true_type has_trivial_destructor;
|
typedef _true_type has_trivial_destructor;
|
||||||
typedef _true_type is_POD_type;
|
typedef _true_type is_POD_type;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "Test\StringTest.h"
|
#include "Test\StringTest.h"
|
||||||
#include "Test\SuffixArrayTest.h"
|
#include "Test\SuffixArrayTest.h"
|
||||||
#include "Test\TrieTreeTest.h"
|
#include "Test\TrieTreeTest.h"
|
||||||
|
#include "Test\TypeTraitsTest.h"
|
||||||
#include "Test\UFSetTest.h"
|
#include "Test\UFSetTest.h"
|
||||||
#include "Test\UniquePtrTest.h"
|
#include "Test\UniquePtrTest.h"
|
||||||
#include "Test\Unordered_setTest.h"
|
#include "Test\Unordered_setTest.h"
|
||||||
@@ -47,6 +48,7 @@ int main(){
|
|||||||
TinySTL::StringTest::testAllCases();
|
TinySTL::StringTest::testAllCases();
|
||||||
TinySTL::SuffixArrayTest::testAllCases();
|
TinySTL::SuffixArrayTest::testAllCases();
|
||||||
TinySTL::TrieTreeTest::testAllCases();
|
TinySTL::TrieTreeTest::testAllCases();
|
||||||
|
TinySTL::TypeTraitsTest::testAllCases();
|
||||||
TinySTL::UFSetTest::testAllCases();
|
TinySTL::UFSetTest::testAllCases();
|
||||||
TinySTL::UniquePtrTest::testAllCases();
|
TinySTL::UniquePtrTest::testAllCases();
|
||||||
TinySTL::Unordered_setTest::testAllCases();
|
TinySTL::Unordered_setTest::testAllCases();
|
||||||
|
|||||||
Reference in New Issue
Block a user