Formatting code

This commit is contained in:
Ilusha 2023-06-30 14:02:55 +00:00
parent 6dc64ce76b
commit 13a8f07e32
37 changed files with 2242 additions and 2281 deletions

View file

@ -51,8 +51,7 @@ struct allocator_test {
return idx;
}
allocator_test(tp::AbstractAllocator* palloc, const char* pallocator_name,
tp::AbstractAllocator* p_parent_alloc) {
allocator_test(tp::AbstractAllocator* palloc, const char* pallocator_name, tp::AbstractAllocator* p_parent_alloc) {
allocator_name = pallocator_name;
parent_alloc = p_parent_alloc;
alloc = palloc;
@ -119,8 +118,7 @@ struct allocator_test {
}
}
void change_states(tp::Range<tp::alni> rg, bool state, bool reversed = false,
bool random = false) {
void change_states(tp::Range<tp::alni> rg, bool state, bool reversed = false, bool random = false) {
for (auto i : rg) {
tp::alni idx = i;
@ -289,7 +287,6 @@ void pool_alloc_test() {
}
void allocators_test() {
printf("running tests on alocators:\n");
heap_alloc_test();

View file

@ -11,12 +11,7 @@ namespace tp {
return hash(key);
}
template<
typename tKey, typename tVal,
class tAllocator = DefaultAllocator,
ualni(*tHashFunc)(SelCopyArg<tKey>) = DefaultHashFunc<tKey>,
int tTableInitialSize = 4
>
template<typename tKey, typename tVal, class tAllocator = DefaultAllocator, ualni(*tHashFunc)(SelCopyArg<tKey>) = DefaultHashFunc<tKey>, int tTableInitialSize = 4>
class Map {
enum {

View file

@ -136,8 +136,7 @@ namespace tp {
template <class T, class U>
struct SuperSubclass {
enum {
value = (::tp::Conversion<const volatile U*, const volatile T*>::exists &&
!::tp::Conversion<const volatile T*, const volatile void*>::sameType)
value = (::tp::Conversion<const volatile U*, const volatile T*>::exists && !::tp::Conversion<const volatile T*, const volatile void*>::sameType)
};
// Dummy enum to make sure that both classes are fully defined.
@ -152,8 +151,7 @@ namespace tp {
template <class U>
struct SuperSubclass<void, U> {
enum {
value = (::tp::Conversion<const volatile U*, const volatile void*>::exists &&
!::tp::Conversion<const volatile void*, const volatile void*>::sameType)
value = (::tp::Conversion<const volatile U*, const volatile void*>::exists && !::tp::Conversion<const volatile void*, const volatile void*>::sameType)
};
// Dummy enum to make sure that both classes are fully defined.
@ -163,8 +161,7 @@ namespace tp {
template <class T>
struct SuperSubclass<T, void> {
enum {
value = (::tp::Conversion<const volatile void*, const volatile T*>::exists &&
!::tp::Conversion<const volatile T*, const volatile void*>::sameType)
value = (::tp::Conversion<const volatile void*, const volatile T*>::exists && !::tp::Conversion<const volatile T*, const volatile void*>::sameType)
};
// Dummy enum to make sure that both classes are fully defined.
@ -433,9 +430,7 @@ namespace tp {
template <class Head, class Tail, class T>
struct Append<Typelist<Head, Tail>, T> {
typedef Typelist<Head,
typename Append<Tail, T>::Result>
Result;
typedef Typelist<Head, typename Append<Tail, T>::Result> Result;
};
////////////////////////////////////////////////////////////////////////////////
@ -460,9 +455,7 @@ namespace tp {
template <class Head, class Tail, class T> // Specialization 3
struct Erase<Typelist<Head, Tail>, T> {
typedef Typelist<Head,
typename Erase<Tail, T>::Result>
Result;
typedef Typelist<Head, typename Erase<Tail, T>::Result> Result;
};
////////////////////////////////////////////////////////////////////////////////
@ -486,9 +479,7 @@ namespace tp {
template <class Head, class Tail, class T>
struct EraseAll<Typelist<Head, Tail>, T> {
// Go all the way down the list removing the type
typedef Typelist<Head,
typename EraseAll<Tail, T>::Result>
Result;
typedef Typelist<Head, typename EraseAll<Tail, T>::Result> Result;
};
////////////////////////////////////////////////////////////////////////////////
@ -535,9 +526,7 @@ namespace tp {
template <class Head, class Tail, class T, class U>
struct Replace<Typelist<Head, Tail>, T, U> {
typedef Typelist<Head,
typename Replace<Tail, T, U>::Result>
Result;
typedef Typelist<Head, typename Replace<Tail, T, U>::Result> Result;
};
////////////////////////////////////////////////////////////////////////////////
@ -562,9 +551,7 @@ namespace tp {
template <class Head, class Tail, class T, class U>
struct ReplaceAll<Typelist<Head, Tail>, T, U> {
typedef Typelist<Head,
typename ReplaceAll<Tail, T, U>::Result>
Result;
typedef Typelist<Head, typename ReplaceAll<Tail, T, U>::Result> Result;
};
////////////////////////////////////////////////////////////////////////////////
@ -584,8 +571,7 @@ namespace tp {
template <class Head, class Tail>
struct Reverse< Typelist<Head, Tail> > {
typedef typename Append<
typename Reverse<Tail>::Result, Head>::Result Result;
typedef typename Append<typename Reverse<Tail>::Result, Head>::Result Result;
};
////////////////////////////////////////////////////////////////////////////////
@ -608,9 +594,7 @@ namespace tp {
private:
typedef typename MostDerived<Tail, T>::Result Candidate;
public:
typedef typename TypeSelect<
SuperSubclass<Candidate, Head>::value,
Head, Candidate>::Result Result;
typedef typename TypeSelect<SuperSubclass<Candidate, Head>::value, Head, Candidate>::Result Result;
};
////////////////////////////////////////////////////////////////////////////////
@ -631,10 +615,8 @@ namespace tp {
template <class Head, class Tail>
struct DerivedToFront< Typelist<Head, Tail> > {
private:
typedef typename MostDerived<Tail, Head>::Result
TheMostDerived;
typedef typename Replace<Tail,
TheMostDerived, Head>::Result Temp;
typedef typename MostDerived<Tail, Head>::Result TheMostDerived;
typedef typename Replace<Tail, TheMostDerived, Head>::Result Temp;
typedef typename DerivedToFront<Temp>::Result L;
public:
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 Seq {
typedef typename Seq< T02, T03, T04, T05, T06, T07, T08, T09, T10,
T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>::list TailResult;
typedef typename Seq<T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>::list TailResult;
public:
typedef Typelist<T01, TailResult> list;
};
@ -868,16 +849,11 @@ namespace tp {
};
public:
typedef typename UnConst<T>::Result
NonConstType;
typedef typename UnVolatile<T>::Result
NonVolatileType;
typedef typename UnVolatile<typename UnConst<T>::Result>::Result
UnqualifiedType;
typedef typename PointerTraits<UnqualifiedType>::PointeeType
PointeeType;
typedef typename ReferenceTraits<T>::ReferredType
ReferredType;
typedef typename UnConst<T>::Result NonConstType;
typedef typename UnVolatile<T>::Result NonVolatileType;
typedef typename UnVolatile<typename UnConst<T>::Result>::Result UnqualifiedType;
typedef typename PointerTraits<UnqualifiedType>::PointeeType PointeeType;
typedef typename ReferenceTraits<T>::ReferredType ReferredType;
enum { isConst = UnConst<T>::isConst };
enum { isVolatile = UnVolatile<T>::isVolatile };
@ -917,8 +893,7 @@ namespace tp {
enum { isArith = isIntegral || isFloat };
enum { isFundamental = isStdFundamental || isArith };
typedef typename TypeSelect<isStdArith || isPointer || isMemberPointer, T, typename Private::AddParameterType<T>::Result>::Result
ParameterType;
typedef typename TypeSelect<isStdArith || isPointer || isMemberPointer, T, typename Private::AddParameterType<T>::Result>::Result ParameterType;
};
}

2
TODO
View file

@ -1,5 +1,3 @@
Convert tabs to spaces
Containers:
Avl read write !
Add check copy times !

View file

@ -5,12 +5,8 @@
#include "Timing.hpp"
#include "Utils.hpp"
#define GETTIMEMSC() \
(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())
#define GETTIMEMSC() (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())
#define THREAD_SLEEP(time_ms) std::this_thread::sleep_for(std::chrono::milliseconds(time_ms))