Formatting code
This commit is contained in:
parent
6dc64ce76b
commit
13a8f07e32
37 changed files with 2242 additions and 2281 deletions
|
|
@ -51,8 +51,7 @@ struct allocator_test {
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocator_test(tp::AbstractAllocator* palloc, const char* pallocator_name,
|
allocator_test(tp::AbstractAllocator* palloc, const char* pallocator_name, tp::AbstractAllocator* p_parent_alloc) {
|
||||||
tp::AbstractAllocator* p_parent_alloc) {
|
|
||||||
allocator_name = pallocator_name;
|
allocator_name = pallocator_name;
|
||||||
parent_alloc = p_parent_alloc;
|
parent_alloc = p_parent_alloc;
|
||||||
alloc = palloc;
|
alloc = palloc;
|
||||||
|
|
@ -119,8 +118,7 @@ struct allocator_test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void change_states(tp::Range<tp::alni> rg, bool state, bool reversed = false,
|
void change_states(tp::Range<tp::alni> rg, bool state, bool reversed = false, bool random = false) {
|
||||||
bool random = false) {
|
|
||||||
for (auto i : rg) {
|
for (auto i : rg) {
|
||||||
tp::alni idx = i;
|
tp::alni idx = i;
|
||||||
|
|
||||||
|
|
@ -289,7 +287,6 @@ void pool_alloc_test() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void allocators_test() {
|
void allocators_test() {
|
||||||
|
|
||||||
printf("running tests on alocators:\n");
|
printf("running tests on alocators:\n");
|
||||||
|
|
||||||
heap_alloc_test();
|
heap_alloc_test();
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,7 @@ namespace tp {
|
||||||
return hash(key);
|
return hash(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<
|
template<typename tKey, typename tVal, class tAllocator = DefaultAllocator, ualni(*tHashFunc)(SelCopyArg<tKey>) = DefaultHashFunc<tKey>, int tTableInitialSize = 4>
|
||||||
typename tKey, typename tVal,
|
|
||||||
class tAllocator = DefaultAllocator,
|
|
||||||
ualni(*tHashFunc)(SelCopyArg<tKey>) = DefaultHashFunc<tKey>,
|
|
||||||
int tTableInitialSize = 4
|
|
||||||
>
|
|
||||||
class Map {
|
class Map {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,7 @@ namespace tp {
|
||||||
template <class T, class U>
|
template <class T, class U>
|
||||||
struct SuperSubclass {
|
struct SuperSubclass {
|
||||||
enum {
|
enum {
|
||||||
value = (::tp::Conversion<const volatile U*, const volatile T*>::exists &&
|
value = (::tp::Conversion<const volatile U*, const volatile T*>::exists && !::tp::Conversion<const volatile T*, const volatile void*>::sameType)
|
||||||
!::tp::Conversion<const volatile T*, const volatile void*>::sameType)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Dummy enum to make sure that both classes are fully defined.
|
// Dummy enum to make sure that both classes are fully defined.
|
||||||
|
|
@ -152,8 +151,7 @@ namespace tp {
|
||||||
template <class U>
|
template <class U>
|
||||||
struct SuperSubclass<void, U> {
|
struct SuperSubclass<void, U> {
|
||||||
enum {
|
enum {
|
||||||
value = (::tp::Conversion<const volatile U*, const volatile void*>::exists &&
|
value = (::tp::Conversion<const volatile U*, const volatile void*>::exists && !::tp::Conversion<const volatile void*, const volatile void*>::sameType)
|
||||||
!::tp::Conversion<const volatile void*, const volatile void*>::sameType)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Dummy enum to make sure that both classes are fully defined.
|
// Dummy enum to make sure that both classes are fully defined.
|
||||||
|
|
@ -163,8 +161,7 @@ namespace tp {
|
||||||
template <class T>
|
template <class T>
|
||||||
struct SuperSubclass<T, void> {
|
struct SuperSubclass<T, void> {
|
||||||
enum {
|
enum {
|
||||||
value = (::tp::Conversion<const volatile void*, const volatile T*>::exists &&
|
value = (::tp::Conversion<const volatile void*, const volatile T*>::exists && !::tp::Conversion<const volatile T*, const volatile void*>::sameType)
|
||||||
!::tp::Conversion<const volatile T*, const volatile void*>::sameType)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Dummy enum to make sure that both classes are fully defined.
|
// Dummy enum to make sure that both classes are fully defined.
|
||||||
|
|
@ -433,9 +430,7 @@ namespace tp {
|
||||||
|
|
||||||
template <class Head, class Tail, class T>
|
template <class Head, class Tail, class T>
|
||||||
struct Append<Typelist<Head, Tail>, T> {
|
struct Append<Typelist<Head, Tail>, T> {
|
||||||
typedef Typelist<Head,
|
typedef Typelist<Head, typename Append<Tail, T>::Result> Result;
|
||||||
typename Append<Tail, T>::Result>
|
|
||||||
Result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -460,9 +455,7 @@ namespace tp {
|
||||||
|
|
||||||
template <class Head, class Tail, class T> // Specialization 3
|
template <class Head, class Tail, class T> // Specialization 3
|
||||||
struct Erase<Typelist<Head, Tail>, T> {
|
struct Erase<Typelist<Head, Tail>, T> {
|
||||||
typedef Typelist<Head,
|
typedef Typelist<Head, typename Erase<Tail, T>::Result> Result;
|
||||||
typename Erase<Tail, T>::Result>
|
|
||||||
Result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -486,9 +479,7 @@ namespace tp {
|
||||||
template <class Head, class Tail, class T>
|
template <class Head, class Tail, class T>
|
||||||
struct EraseAll<Typelist<Head, Tail>, T> {
|
struct EraseAll<Typelist<Head, Tail>, T> {
|
||||||
// Go all the way down the list removing the type
|
// Go all the way down the list removing the type
|
||||||
typedef Typelist<Head,
|
typedef Typelist<Head, typename EraseAll<Tail, T>::Result> Result;
|
||||||
typename EraseAll<Tail, T>::Result>
|
|
||||||
Result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -535,9 +526,7 @@ namespace tp {
|
||||||
|
|
||||||
template <class Head, class Tail, class T, class U>
|
template <class Head, class Tail, class T, class U>
|
||||||
struct Replace<Typelist<Head, Tail>, T, U> {
|
struct Replace<Typelist<Head, Tail>, T, U> {
|
||||||
typedef Typelist<Head,
|
typedef Typelist<Head, typename Replace<Tail, T, U>::Result> Result;
|
||||||
typename Replace<Tail, T, U>::Result>
|
|
||||||
Result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -562,9 +551,7 @@ namespace tp {
|
||||||
|
|
||||||
template <class Head, class Tail, class T, class U>
|
template <class Head, class Tail, class T, class U>
|
||||||
struct ReplaceAll<Typelist<Head, Tail>, T, U> {
|
struct ReplaceAll<Typelist<Head, Tail>, T, U> {
|
||||||
typedef Typelist<Head,
|
typedef Typelist<Head, typename ReplaceAll<Tail, T, U>::Result> Result;
|
||||||
typename ReplaceAll<Tail, T, U>::Result>
|
|
||||||
Result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -584,8 +571,7 @@ namespace tp {
|
||||||
|
|
||||||
template <class Head, class Tail>
|
template <class Head, class Tail>
|
||||||
struct Reverse< Typelist<Head, Tail> > {
|
struct Reverse< Typelist<Head, Tail> > {
|
||||||
typedef typename Append<
|
typedef typename Append<typename Reverse<Tail>::Result, Head>::Result Result;
|
||||||
typename Reverse<Tail>::Result, Head>::Result Result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -608,9 +594,7 @@ namespace tp {
|
||||||
private:
|
private:
|
||||||
typedef typename MostDerived<Tail, T>::Result Candidate;
|
typedef typename MostDerived<Tail, T>::Result Candidate;
|
||||||
public:
|
public:
|
||||||
typedef typename TypeSelect<
|
typedef typename TypeSelect<SuperSubclass<Candidate, Head>::value, Head, Candidate>::Result Result;
|
||||||
SuperSubclass<Candidate, Head>::value,
|
|
||||||
Head, Candidate>::Result Result;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -631,10 +615,8 @@ namespace tp {
|
||||||
template <class Head, class Tail>
|
template <class Head, class Tail>
|
||||||
struct DerivedToFront< Typelist<Head, Tail> > {
|
struct DerivedToFront< Typelist<Head, Tail> > {
|
||||||
private:
|
private:
|
||||||
typedef typename MostDerived<Tail, Head>::Result
|
typedef typename MostDerived<Tail, Head>::Result TheMostDerived;
|
||||||
TheMostDerived;
|
typedef typename Replace<Tail, TheMostDerived, Head>::Result Temp;
|
||||||
typedef typename Replace<Tail,
|
|
||||||
TheMostDerived, Head>::Result Temp;
|
|
||||||
typedef typename DerivedToFront<Temp>::Result L;
|
typedef typename DerivedToFront<Temp>::Result L;
|
||||||
public:
|
public:
|
||||||
typedef Typelist<TheMostDerived, L> Result;
|
typedef Typelist<TheMostDerived, L> Result;
|
||||||
|
|
@ -650,8 +632,7 @@ namespace tp {
|
||||||
class T16 = NullType, class T17 = NullType, class T18 = NullType, class T19 = NullType, class T20 = NullType
|
class T16 = NullType, class T17 = NullType, class T18 = NullType, class T19 = NullType, class T20 = NullType
|
||||||
>
|
>
|
||||||
class Seq {
|
class Seq {
|
||||||
typedef typename Seq< T02, T03, T04, T05, T06, T07, T08, T09, T10,
|
typedef typename Seq<T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>::list TailResult;
|
||||||
T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>::list TailResult;
|
|
||||||
public:
|
public:
|
||||||
typedef Typelist<T01, TailResult> list;
|
typedef Typelist<T01, TailResult> list;
|
||||||
};
|
};
|
||||||
|
|
@ -868,16 +849,11 @@ namespace tp {
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename UnConst<T>::Result
|
typedef typename UnConst<T>::Result NonConstType;
|
||||||
NonConstType;
|
typedef typename UnVolatile<T>::Result NonVolatileType;
|
||||||
typedef typename UnVolatile<T>::Result
|
typedef typename UnVolatile<typename UnConst<T>::Result>::Result UnqualifiedType;
|
||||||
NonVolatileType;
|
typedef typename PointerTraits<UnqualifiedType>::PointeeType PointeeType;
|
||||||
typedef typename UnVolatile<typename UnConst<T>::Result>::Result
|
typedef typename ReferenceTraits<T>::ReferredType ReferredType;
|
||||||
UnqualifiedType;
|
|
||||||
typedef typename PointerTraits<UnqualifiedType>::PointeeType
|
|
||||||
PointeeType;
|
|
||||||
typedef typename ReferenceTraits<T>::ReferredType
|
|
||||||
ReferredType;
|
|
||||||
|
|
||||||
enum { isConst = UnConst<T>::isConst };
|
enum { isConst = UnConst<T>::isConst };
|
||||||
enum { isVolatile = UnVolatile<T>::isVolatile };
|
enum { isVolatile = UnVolatile<T>::isVolatile };
|
||||||
|
|
@ -917,8 +893,7 @@ namespace tp {
|
||||||
enum { isArith = isIntegral || isFloat };
|
enum { isArith = isIntegral || isFloat };
|
||||||
enum { isFundamental = isStdFundamental || isArith };
|
enum { isFundamental = isStdFundamental || isArith };
|
||||||
|
|
||||||
typedef typename TypeSelect<isStdArith || isPointer || isMemberPointer, T, typename Private::AddParameterType<T>::Result>::Result
|
typedef typename TypeSelect<isStdArith || isPointer || isMemberPointer, T, typename Private::AddParameterType<T>::Result>::Result ParameterType;
|
||||||
ParameterType;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
TODO
2
TODO
|
|
@ -1,5 +1,3 @@
|
||||||
Convert tabs to spaces
|
|
||||||
|
|
||||||
Containers:
|
Containers:
|
||||||
Avl read write !
|
Avl read write !
|
||||||
Add check copy times !
|
Add check copy times !
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,8 @@
|
||||||
#include "Timing.hpp"
|
#include "Timing.hpp"
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
|
||||||
#define GETTIMEMSC() \
|
#define GETTIMEMSC() (time_ms)\
|
||||||
(time_ms)( \
|
(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now()).time_since_epoch()).count())
|
||||||
std::chrono::duration_cast<std::chrono::milliseconds>( \
|
|
||||||
std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now()) \
|
|
||||||
.time_since_epoch()) \
|
|
||||||
.count())
|
|
||||||
|
|
||||||
#define THREAD_SLEEP(time_ms) std::this_thread::sleep_for(std::chrono::milliseconds(time_ms))
|
#define THREAD_SLEEP(time_ms) std::this_thread::sleep_for(std::chrono::milliseconds(time_ms))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue