mirror of
https://github.com/mangosfour/server.git
synced 2025-12-30 19:37:04 +00:00
[9775] Cleanups in framework library.
* Removed last bits of threading in grid code. * Removed some weird and unneeded declarations. * General code style fixes. * (Perhaps some things I forgot.) Thanks to Lynx3d for the usual GCC-stabbing...
This commit is contained in:
parent
4d89b41f60
commit
7532061a79
25 changed files with 774 additions and 398 deletions
|
|
@ -23,13 +23,13 @@
|
|||
for cross platform where they have different endians.
|
||||
*/
|
||||
|
||||
#include<Platform/Define.h>
|
||||
#include<algorithm>
|
||||
#include <Platform/Define.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace ByteConverter
|
||||
{
|
||||
template<size_t T>
|
||||
inline void convert(char *val)
|
||||
inline void convert(char *val)
|
||||
{
|
||||
std::swap(*val, *(val + T - 1));
|
||||
convert<T - 2>(val + 1);
|
||||
|
|
@ -38,7 +38,8 @@ namespace ByteConverter
|
|||
template<> inline void convert<0>(char *) {}
|
||||
template<> inline void convert<1>(char *) {} // ignore central byte
|
||||
|
||||
template<typename T> inline void apply(T *val)
|
||||
template<typename T>
|
||||
inline void apply(T *val)
|
||||
{
|
||||
convert<sizeof(T)>((char *)(val));
|
||||
}
|
||||
|
|
@ -56,7 +57,7 @@ template<typename T> void EndianConvert(T*); // will generate link error
|
|||
template<typename T> void EndianConvertReverse(T*); // will generate link error
|
||||
|
||||
inline void EndianConvert(uint8&) { }
|
||||
inline void EndianConvert( int8&) { }
|
||||
inline void EndianConvert(int8&) { }
|
||||
inline void EndianConvertReverse(uint8&) { }
|
||||
inline void EndianConvertReverse( int8&) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@
|
|||
|
||||
namespace MaNGOS
|
||||
{
|
||||
template < class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void >
|
||||
template<class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void>
|
||||
class _Callback
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1, ParamType2, ParamType3, ParamType4);
|
||||
Class *m_object;
|
||||
Method m_method;
|
||||
|
|
@ -35,17 +36,27 @@ namespace MaNGOS
|
|||
ParamType3 m_param3;
|
||||
ParamType4 m_param4;
|
||||
void _Execute() { (m_object->*m_method)(m_param1, m_param2, m_param3, m_param4); }
|
||||
|
||||
public:
|
||||
|
||||
_Callback(Class *object, Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3, ParamType4 param4)
|
||||
: m_object(object), m_method(method), m_param1(param1), m_param2(param2), m_param3(param3), m_param4(param4) {}
|
||||
_Callback(_Callback < Class, ParamType1, ParamType2, ParamType3, ParamType4> const& cb)
|
||||
: m_object(cb.object), m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4) {}
|
||||
: m_object(object), m_method(method),
|
||||
m_param1(param1), m_param2(param2), m_param3(param3), m_param4(param4)
|
||||
{
|
||||
}
|
||||
|
||||
_Callback(_Callback<Class, ParamType1, ParamType2, ParamType3, ParamType4> const& cb)
|
||||
: m_object(cb.object), m_method(cb.m_method),
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1, typename ParamType2, typename ParamType3 >
|
||||
class _Callback < Class, ParamType1, ParamType2, ParamType3 >
|
||||
template<class Class, typename ParamType1, typename ParamType2, typename ParamType3>
|
||||
class _Callback<Class, ParamType1, ParamType2, ParamType3>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1, ParamType2, ParamType3);
|
||||
Class *m_object;
|
||||
Method m_method;
|
||||
|
|
@ -53,67 +64,102 @@ namespace MaNGOS
|
|||
ParamType2 m_param2;
|
||||
ParamType3 m_param3;
|
||||
void _Execute() { (m_object->*m_method)(m_param1, m_param2, m_param3); }
|
||||
|
||||
public:
|
||||
_Callback(Class *object, Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: m_object(object), m_method(method), m_param1(param1), m_param2(param2) {}
|
||||
_Callback(_Callback < Class, ParamType1, ParamType2, ParamType3 > const& cb)
|
||||
: m_object(cb.object), m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3) {}
|
||||
: m_object(object), m_method(method),
|
||||
m_param1(param1), m_param2(param2)
|
||||
{
|
||||
}
|
||||
|
||||
_Callback(_Callback<Class, ParamType1, ParamType2, ParamType3> const& cb)
|
||||
: m_object(cb.object), m_method(cb.m_method),
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1, typename ParamType2 >
|
||||
class _Callback < Class, ParamType1, ParamType2 >
|
||||
template<class Class, typename ParamType1, typename ParamType2>
|
||||
class _Callback<Class, ParamType1, ParamType2>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1, ParamType2);
|
||||
Class *m_object;
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
ParamType2 m_param2;
|
||||
void _Execute() { (m_object->*m_method)(m_param1, m_param2); }
|
||||
|
||||
public:
|
||||
|
||||
_Callback(Class *object, Method method, ParamType1 param1, ParamType2 param2)
|
||||
: m_object(object), m_method(method), m_param1(param1), m_param2(param2) {}
|
||||
_Callback(_Callback < Class, ParamType1, ParamType2 > const& cb)
|
||||
: m_object(cb.m_object), m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2) {}
|
||||
: m_object(object), m_method(method),
|
||||
m_param1(param1), m_param2(param2)
|
||||
{
|
||||
}
|
||||
|
||||
_Callback(_Callback<Class, ParamType1, ParamType2> const& cb)
|
||||
: m_object(cb.m_object), m_method(cb.m_method),
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1 >
|
||||
class _Callback < Class, ParamType1 >
|
||||
template<class Class, typename ParamType1>
|
||||
class _Callback<Class, ParamType1>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1);
|
||||
Class *m_object;
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
void _Execute() { (m_object->*m_method)(m_param1); }
|
||||
|
||||
public:
|
||||
|
||||
_Callback(Class *object, Method method, ParamType1 param1)
|
||||
: m_object(object), m_method(method), m_param1(param1) {}
|
||||
_Callback(_Callback < Class, ParamType1 > const& cb)
|
||||
: m_object(cb.m_object), m_method(cb.m_method), m_param1(cb.m_param1) {}
|
||||
: m_object(object), m_method(method),
|
||||
m_param1(param1)
|
||||
{
|
||||
}
|
||||
|
||||
_Callback(_Callback<Class, ParamType1> const& cb)
|
||||
: m_object(cb.m_object), m_method(cb.m_method),
|
||||
m_param1(cb.m_param1)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class >
|
||||
class _Callback < Class >
|
||||
template<class Class>
|
||||
class _Callback<Class>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (Class::*Method)();
|
||||
Class *m_object;
|
||||
Method m_method;
|
||||
void _Execute() { (m_object->*m_method)(); }
|
||||
|
||||
public:
|
||||
_Callback(Class *object, Method method)
|
||||
: m_object(object), m_method(method) {}
|
||||
_Callback(_Callback < Class > const& cb)
|
||||
: m_object(cb.m_object), m_method(cb.m_method) {}
|
||||
: m_object(object), m_method(method)
|
||||
{
|
||||
}
|
||||
_Callback(_Callback<Class> const& cb)
|
||||
: m_object(cb.m_object), m_method(cb.m_method)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// ---- Statics ----
|
||||
|
||||
template < typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void >
|
||||
template<typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void>
|
||||
class _SCallback
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (*Method)(ParamType1, ParamType2, ParamType3, ParamType4);
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
|
|
@ -121,73 +167,116 @@ namespace MaNGOS
|
|||
ParamType3 m_param3;
|
||||
ParamType4 m_param4;
|
||||
void _Execute() { (*m_method)(m_param1, m_param2, m_param3, m_param4); }
|
||||
|
||||
public:
|
||||
|
||||
_SCallback(Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3, ParamType4 param4)
|
||||
: m_method(method), m_param1(param1), m_param2(param2), m_param3(param3), m_param4(param4) {}
|
||||
_SCallback(_SCallback < ParamType1, ParamType2, ParamType3, ParamType4> const& cb)
|
||||
: m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4) {}
|
||||
: m_method(method),
|
||||
m_param1(param1), m_param2(param2), m_param3(param3), m_param4(param4)
|
||||
{
|
||||
}
|
||||
|
||||
_SCallback(_SCallback<ParamType1, ParamType2, ParamType3, ParamType4> const& cb)
|
||||
: m_method(cb.m_method),
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < typename ParamType1, typename ParamType2, typename ParamType3 >
|
||||
class _SCallback < ParamType1, ParamType2, ParamType3 >
|
||||
template<typename ParamType1, typename ParamType2, typename ParamType3>
|
||||
class _SCallback<ParamType1, ParamType2, ParamType3>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (*Method)(ParamType1, ParamType2, ParamType3);
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
ParamType2 m_param2;
|
||||
ParamType3 m_param3;
|
||||
void _Execute() { (*m_method)(m_param1, m_param2, m_param3); }
|
||||
|
||||
public:
|
||||
_SCallback(Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: m_method(method), m_param1(param1), m_param2(param2), m_param3(param3) {}
|
||||
_SCallback(_SCallback < ParamType1, ParamType2, ParamType3 > const& cb)
|
||||
: m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3) {}
|
||||
: m_method(method),
|
||||
m_param1(param1), m_param2(param2), m_param3(param3)
|
||||
{
|
||||
}
|
||||
_SCallback(_SCallback<ParamType1, ParamType2, ParamType3> const& cb)
|
||||
: m_method(cb.m_method),
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < typename ParamType1, typename ParamType2 >
|
||||
class _SCallback < ParamType1, ParamType2 >
|
||||
template<typename ParamType1, typename ParamType2>
|
||||
class _SCallback<ParamType1, ParamType2>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (*Method)(ParamType1, ParamType2);
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
ParamType2 m_param2;
|
||||
void _Execute() { (*m_method)(m_param1, m_param2); }
|
||||
|
||||
public:
|
||||
_SCallback(Method method, ParamType1 param1, ParamType2 param2)
|
||||
: m_method(method), m_param1(param1), m_param2(param2) {}
|
||||
_SCallback(_SCallback < ParamType1, ParamType2 > const& cb)
|
||||
: m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2) {}
|
||||
: m_method(method),
|
||||
m_param1(param1), m_param2(param2)
|
||||
{
|
||||
}
|
||||
|
||||
_SCallback(_SCallback<ParamType1, ParamType2> const& cb)
|
||||
: m_method(cb.m_method),
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < typename ParamType1 >
|
||||
class _SCallback < ParamType1 >
|
||||
template<typename ParamType1>
|
||||
class _SCallback<ParamType1>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (*Method)(ParamType1);
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
void _Execute() { (*m_method)(m_param1); }
|
||||
|
||||
public:
|
||||
_SCallback(Method method, ParamType1 param1)
|
||||
: m_method(method), m_param1(param1) {}
|
||||
_SCallback(_SCallback < ParamType1 > const& cb)
|
||||
: m_method(cb.m_method), m_param1(cb.m_param1) {}
|
||||
: m_method(method),
|
||||
m_param1(param1)
|
||||
{
|
||||
}
|
||||
|
||||
_SCallback(_SCallback<ParamType1> const& cb)
|
||||
: m_method(cb.m_method),
|
||||
m_param1(cb.m_param1)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < >
|
||||
class _SCallback < >
|
||||
template<>
|
||||
class _SCallback<>
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef void (*Method)();
|
||||
Method m_method;
|
||||
void _Execute() { (*m_method)(); }
|
||||
|
||||
public:
|
||||
|
||||
_SCallback(Method method)
|
||||
: m_method(method) {}
|
||||
_SCallback(_SCallback <> const& cb)
|
||||
: m_method(cb.m_method) {}
|
||||
: m_method(method)
|
||||
{
|
||||
}
|
||||
|
||||
_SCallback(_SCallback<> const& cb)
|
||||
: m_method(cb.m_method)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -198,70 +287,93 @@ namespace MaNGOS
|
|||
class ICallback
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Execute() = 0;
|
||||
virtual ~ICallback() {}
|
||||
};
|
||||
|
||||
template < class CB >
|
||||
template<class CB>
|
||||
class _ICallback : public CB, public ICallback
|
||||
{
|
||||
public:
|
||||
_ICallback(CB const& cb) : CB(cb) {}
|
||||
|
||||
_ICallback(CB const& cb) : CB(cb)
|
||||
{
|
||||
}
|
||||
|
||||
void Execute() { CB::_Execute(); }
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void >
|
||||
class Callback :
|
||||
public _ICallback< _Callback < Class, ParamType1, ParamType2, ParamType3, ParamType4 > >
|
||||
template<class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void, typename ParamType4 = void>
|
||||
class Callback : public _ICallback<_Callback<Class, ParamType1, ParamType2, ParamType3, ParamType4> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, ParamType1, ParamType2, ParamType3, ParamType4 > C4;
|
||||
|
||||
typedef _Callback<Class, ParamType1, ParamType2, ParamType3, ParamType4> C4;
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C4::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3, ParamType4 param4)
|
||||
: _ICallback< C4 >(C4(object, method, param1, param2, param3, param4)) {}
|
||||
: _ICallback<C4>(C4(object, method, param1, param2, param3, param4))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1, typename ParamType2, typename ParamType3 >
|
||||
class Callback < Class, ParamType1, ParamType2, ParamType3 > :
|
||||
public _ICallback< _Callback < Class, ParamType1, ParamType2, ParamType3 > >
|
||||
template<class Class, typename ParamType1, typename ParamType2, typename ParamType3>
|
||||
class Callback<Class, ParamType1, ParamType2, ParamType3> : public _ICallback<_Callback<Class, ParamType1, ParamType2, ParamType3> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, ParamType1, ParamType2, ParamType3 > C3;
|
||||
|
||||
typedef _Callback<Class, ParamType1, ParamType2, ParamType3> C3;
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C3::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: _ICallback< C3 >(C3(object, method, param1, param2, param3)) {}
|
||||
: _ICallback<C3>(C3(object, method, param1, param2, param3))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1, typename ParamType2 >
|
||||
class Callback < Class, ParamType1, ParamType2 > :
|
||||
public _ICallback< _Callback < Class, ParamType1, ParamType2 > >
|
||||
template<class Class, typename ParamType1, typename ParamType2>
|
||||
class Callback<Class, ParamType1, ParamType2> : public _ICallback<_Callback<Class, ParamType1, ParamType2> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, ParamType1, ParamType2 > C2;
|
||||
|
||||
typedef _Callback<Class, ParamType1, ParamType2> C2;
|
||||
|
||||
public:
|
||||
Callback(Class *object, typename C2::Method method, ParamType1 param1, ParamType2 param2)
|
||||
: _ICallback< C2 >(C2(object, method, param1, param2)) {}
|
||||
: _ICallback<C2>(C2(object, method, param1, param2))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1 >
|
||||
class Callback < Class, ParamType1 > :
|
||||
public _ICallback< _Callback < Class, ParamType1 > >
|
||||
template<class Class, typename ParamType1>
|
||||
class Callback<Class, ParamType1> : public _ICallback<_Callback<Class, ParamType1> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, ParamType1 > C1;
|
||||
|
||||
typedef _Callback<Class, ParamType1> C1;
|
||||
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C1::Method method, ParamType1 param1)
|
||||
: _ICallback< C1 >(C1(object, method, param1)) {}
|
||||
: _ICallback<C1>(C1(object, method, param1))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class >
|
||||
class Callback < Class > : public _ICallback< _Callback < Class > >
|
||||
template<class Class>
|
||||
class Callback<Class> : public _ICallback<_Callback<Class> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class > C0;
|
||||
|
||||
typedef _Callback<Class> C0;
|
||||
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C0::Method method)
|
||||
: _ICallback< C0 >(C0(object, method)) {}
|
||||
: _ICallback<C0>(C0(object, method))
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -274,108 +386,146 @@ namespace MaNGOS
|
|||
class IQueryCallback
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Execute() = 0;
|
||||
virtual ~IQueryCallback() {}
|
||||
virtual void SetResult(QueryResult* result) = 0;
|
||||
virtual QueryResult* GetResult() = 0;
|
||||
};
|
||||
|
||||
template < class CB >
|
||||
template<class CB>
|
||||
class _IQueryCallback : public CB, public IQueryCallback
|
||||
{
|
||||
public:
|
||||
_IQueryCallback(CB const& cb) : CB(cb) {}
|
||||
|
||||
_IQueryCallback(CB const& cb) : CB(cb)
|
||||
{
|
||||
}
|
||||
|
||||
void Execute() { CB::_Execute(); }
|
||||
void SetResult(QueryResult* result) { CB::m_param1 = result; }
|
||||
QueryResult* GetResult() { return CB::m_param1; }
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void >
|
||||
class QueryCallback :
|
||||
public _IQueryCallback< _Callback < Class, QueryResult*, ParamType1, ParamType2, ParamType3 > >
|
||||
template<class Class, typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void>
|
||||
class QueryCallback : public _IQueryCallback<_Callback<Class, QueryResult*, ParamType1, ParamType2, ParamType3> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, QueryResult*, ParamType1, ParamType2, ParamType3 > QC3;
|
||||
|
||||
typedef _Callback<Class, QueryResult*, ParamType1, ParamType2, ParamType3> QC3;
|
||||
|
||||
public:
|
||||
|
||||
QueryCallback(Class *object, typename QC3::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: _IQueryCallback< QC3 >(QC3(object, method, result, param1, param2, param3)) {}
|
||||
: _IQueryCallback<QC3>(QC3(object, method, result, param1, param2, param3))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1, typename ParamType2 >
|
||||
class QueryCallback < Class, ParamType1, ParamType2 > :
|
||||
public _IQueryCallback< _Callback < Class, QueryResult*, ParamType1, ParamType2 > >
|
||||
template<class Class, typename ParamType1, typename ParamType2>
|
||||
class QueryCallback<Class, ParamType1, ParamType2> : public _IQueryCallback<_Callback<Class, QueryResult*, ParamType1, ParamType2> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, QueryResult*, ParamType1, ParamType2 > QC2;
|
||||
|
||||
typedef _Callback<Class, QueryResult*, ParamType1, ParamType2> QC2;
|
||||
|
||||
public:
|
||||
|
||||
QueryCallback(Class *object, typename QC2::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2)
|
||||
: _IQueryCallback< QC2 >(QC2(object, method, result, param1, param2)) {}
|
||||
: _IQueryCallback<QC2>(QC2(object, method, result, param1, param2))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class, typename ParamType1 >
|
||||
class QueryCallback < Class, ParamType1 > :
|
||||
public _IQueryCallback< _Callback < Class, QueryResult*, ParamType1 > >
|
||||
template<class Class, typename ParamType1>
|
||||
class QueryCallback<Class, ParamType1> : public _IQueryCallback<_Callback<Class, QueryResult*, ParamType1> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, QueryResult*, ParamType1 > QC1;
|
||||
|
||||
typedef _Callback<Class, QueryResult*, ParamType1> QC1;
|
||||
|
||||
public:
|
||||
|
||||
QueryCallback(Class *object, typename QC1::Method method, QueryResult* result, ParamType1 param1)
|
||||
: _IQueryCallback< QC1 >(QC1(object, method, result, param1)) {}
|
||||
: _IQueryCallback<QC1>(QC1(object, method, result, param1))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < class Class >
|
||||
class QueryCallback < Class > : public _IQueryCallback< _Callback < Class, QueryResult* > >
|
||||
template<class Class>
|
||||
class QueryCallback<Class> : public _IQueryCallback<_Callback<Class, QueryResult*> >
|
||||
{
|
||||
private:
|
||||
typedef _Callback < Class, QueryResult* > QC0;
|
||||
|
||||
typedef _Callback<Class, QueryResult*> QC0;
|
||||
|
||||
public:
|
||||
QueryCallback(Class *object, typename QC0::Method method, QueryResult* result)
|
||||
: _IQueryCallback< QC0 >(QC0(object, method, result)) {}
|
||||
: _IQueryCallback<QC0>(QC0(object, method, result))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/// ---- Statics ----
|
||||
|
||||
template < typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void >
|
||||
class SQueryCallback :
|
||||
public _IQueryCallback< _SCallback < QueryResult*, ParamType1, ParamType2, ParamType3 > >
|
||||
template<typename ParamType1 = void, typename ParamType2 = void, typename ParamType3 = void>
|
||||
class SQueryCallback : public _IQueryCallback<_SCallback<QueryResult*, ParamType1, ParamType2, ParamType3> >
|
||||
{
|
||||
private:
|
||||
typedef _SCallback < QueryResult*, ParamType1, ParamType2, ParamType3 > QC3;
|
||||
|
||||
typedef _SCallback<QueryResult*, ParamType1, ParamType2, ParamType3> QC3;
|
||||
|
||||
public:
|
||||
|
||||
SQueryCallback(typename QC3::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: _IQueryCallback< QC3 >(QC3(method, result, param1, param2, param3)) {}
|
||||
: _IQueryCallback<QC3>(QC3(method, result, param1, param2, param3))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < typename ParamType1, typename ParamType2 >
|
||||
class SQueryCallback < ParamType1, ParamType2 > :
|
||||
public _IQueryCallback< _SCallback < QueryResult*, ParamType1, ParamType2 > >
|
||||
template<typename ParamType1, typename ParamType2>
|
||||
class SQueryCallback < ParamType1, ParamType2 > : public _IQueryCallback<_SCallback<QueryResult*, ParamType1, ParamType2> >
|
||||
{
|
||||
private:
|
||||
typedef _SCallback < QueryResult*, ParamType1, ParamType2 > QC2;
|
||||
|
||||
typedef _SCallback<QueryResult*, ParamType1, ParamType2> QC2;
|
||||
|
||||
public:
|
||||
|
||||
SQueryCallback(typename QC2::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2)
|
||||
: _IQueryCallback< QC2 >(QC2(method, result, param1, param2)) {}
|
||||
: _IQueryCallback<QC2>(QC2(method, result, param1, param2))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < typename ParamType1 >
|
||||
class SQueryCallback < ParamType1 > :
|
||||
public _IQueryCallback< _SCallback < QueryResult*, ParamType1 > >
|
||||
template<typename ParamType1>
|
||||
class SQueryCallback<ParamType1> : public _IQueryCallback<_SCallback<QueryResult*, ParamType1> >
|
||||
{
|
||||
private:
|
||||
typedef _SCallback < QueryResult*, ParamType1 > QC1;
|
||||
|
||||
typedef _SCallback<QueryResult*, ParamType1> QC1;
|
||||
|
||||
public:
|
||||
|
||||
SQueryCallback(typename QC1::Method method, QueryResult* result, ParamType1 param1)
|
||||
: _IQueryCallback< QC1 >(QC1(method, result, param1)) {}
|
||||
: _IQueryCallback<QC1>(QC1(method, result, param1))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template < >
|
||||
class SQueryCallback < > : public _IQueryCallback< _SCallback < QueryResult* > >
|
||||
template<>
|
||||
class SQueryCallback<> : public _IQueryCallback<_SCallback<QueryResult*> >
|
||||
{
|
||||
private:
|
||||
typedef _SCallback < QueryResult* > QC0;
|
||||
|
||||
typedef _SCallback<QueryResult*> QC0;
|
||||
|
||||
public:
|
||||
|
||||
SQueryCallback(QC0::Method method, QueryResult* result)
|
||||
: _IQueryCallback< QC0 >(QC0(method, result)) {}
|
||||
: _IQueryCallback<QC0>(QC0(method, result))
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,28 +71,30 @@ void EventProcessor::KillAllEvents(bool force)
|
|||
|
||||
i_old->second->to_Abort = true;
|
||||
i_old->second->Abort(m_time);
|
||||
if(force || i_old->second->IsDeletable())
|
||||
if (force || i_old->second->IsDeletable())
|
||||
{
|
||||
delete i_old->second;
|
||||
|
||||
if(!force) // need per-element cleanup
|
||||
if (!force) // need per-element cleanup
|
||||
m_events.erase (i_old);
|
||||
}
|
||||
}
|
||||
|
||||
// fast clear event list (in force case)
|
||||
if(force)
|
||||
if (force)
|
||||
m_events.clear();
|
||||
}
|
||||
|
||||
void EventProcessor::AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime)
|
||||
{
|
||||
if (set_addtime) Event->m_addTime = m_time;
|
||||
if (set_addtime)
|
||||
Event->m_addTime = m_time;
|
||||
|
||||
Event->m_execTime = e_time;
|
||||
m_events.insert(std::pair<uint64, BasicEvent*>(e_time, Event));
|
||||
}
|
||||
|
||||
uint64 EventProcessor::CalculateTime(uint64 t_offset)
|
||||
{
|
||||
return(m_time + t_offset);
|
||||
return m_time + t_offset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,14 +21,19 @@
|
|||
|
||||
#include "Platform/Define.h"
|
||||
|
||||
#include<map>
|
||||
#include <map>
|
||||
|
||||
// Note. All times are in milliseconds here.
|
||||
|
||||
class BasicEvent
|
||||
{
|
||||
public:
|
||||
BasicEvent() { to_Abort = false; }
|
||||
|
||||
BasicEvent()
|
||||
: to_Abort(false)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~BasicEvent() // override destructor to perform some actions on event removal
|
||||
{
|
||||
};
|
||||
|
|
@ -55,6 +60,7 @@ typedef std::multimap<uint64, BasicEvent*> EventList;
|
|||
class EventProcessor
|
||||
{
|
||||
public:
|
||||
|
||||
EventProcessor();
|
||||
~EventProcessor();
|
||||
|
||||
|
|
@ -62,9 +68,12 @@ class EventProcessor
|
|||
void KillAllEvents(bool force);
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time, bool set_addtime = true);
|
||||
uint64 CalculateTime(uint64 t_offset);
|
||||
|
||||
protected:
|
||||
|
||||
uint64 m_time;
|
||||
EventList m_events;
|
||||
bool m_aborting;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,17 +27,20 @@ class LinkedListHead;
|
|||
class LinkedListElement
|
||||
{
|
||||
private:
|
||||
|
||||
friend class LinkedListHead;
|
||||
|
||||
LinkedListElement* iNext;
|
||||
LinkedListElement* iPrev;
|
||||
|
||||
public:
|
||||
LinkedListElement() { iNext = NULL; iPrev = NULL; }
|
||||
|
||||
LinkedListElement() { iNext = NULL; iPrev = NULL; }
|
||||
~LinkedListElement() { delink(); }
|
||||
|
||||
bool hasNext() const { return(iNext->iNext != NULL); }
|
||||
bool hasPrev() const { return(iPrev->iPrev != NULL); }
|
||||
bool isInList() const { return(iNext != NULL && iPrev != NULL); }
|
||||
bool hasNext() const { return (iNext->iNext != NULL); }
|
||||
bool hasPrev() const { return (iPrev->iPrev != NULL); }
|
||||
bool isInList() const { return (iNext != NULL && iPrev != NULL); }
|
||||
|
||||
LinkedListElement * next() { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement const* next() const { return hasNext() ? iNext : NULL; }
|
||||
|
|
@ -51,9 +54,12 @@ class LinkedListElement
|
|||
|
||||
void delink()
|
||||
{
|
||||
if(isInList())
|
||||
if (isInList())
|
||||
{
|
||||
iNext->iPrev = iPrev; iPrev->iNext = iNext; iNext = NULL; iPrev = NULL;
|
||||
iNext->iPrev = iPrev;
|
||||
iPrev->iNext = iNext;
|
||||
iNext = NULL;
|
||||
iPrev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,10 +85,13 @@ class LinkedListElement
|
|||
class LinkedListHead
|
||||
{
|
||||
private:
|
||||
|
||||
LinkedListElement iFirst;
|
||||
LinkedListElement iLast;
|
||||
uint32 iSize;
|
||||
|
||||
public:
|
||||
|
||||
LinkedListHead()
|
||||
{
|
||||
// create empty list
|
||||
|
|
@ -92,13 +101,13 @@ class LinkedListHead
|
|||
iSize = 0;
|
||||
}
|
||||
|
||||
bool isEmpty() const { return(!iFirst.iNext->isInList()); }
|
||||
bool isEmpty() const { return (!iFirst.iNext->isInList()); }
|
||||
|
||||
LinkedListElement * getFirst() { return(isEmpty() ? NULL : iFirst.iNext); }
|
||||
LinkedListElement const* getFirst() const { return(isEmpty() ? NULL : iFirst.iNext); }
|
||||
LinkedListElement * getFirst() { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
LinkedListElement const* getFirst() const { return (isEmpty() ? NULL : iFirst.iNext); }
|
||||
|
||||
LinkedListElement * getLast() { return(isEmpty() ? NULL : iLast.iPrev); }
|
||||
LinkedListElement const* getLast() const { return(isEmpty() ? NULL : iLast.iPrev); }
|
||||
LinkedListElement * getLast() { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
LinkedListElement const* getLast() const { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
|
||||
void insertFirst(LinkedListElement* pElem)
|
||||
{
|
||||
|
|
@ -112,15 +121,17 @@ class LinkedListHead
|
|||
|
||||
uint32 getSize() const
|
||||
{
|
||||
if(!iSize)
|
||||
if (!iSize)
|
||||
{
|
||||
uint32 result = 0;
|
||||
LinkedListElement const* e = getFirst();
|
||||
|
||||
while(e)
|
||||
{
|
||||
++result;
|
||||
e = e->next();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else
|
||||
|
|
@ -131,24 +142,27 @@ class LinkedListHead
|
|||
void decSize() { --iSize; }
|
||||
|
||||
template<class _Ty>
|
||||
class Iterator
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef _Ty value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef ptrdiff_t distance_type;
|
||||
typedef _Ty* pointer;
|
||||
typedef _Ty const* const_pointer;
|
||||
typedef _Ty& reference;
|
||||
typedef _Ty const & const_reference;
|
||||
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef _Ty value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef ptrdiff_t distance_type;
|
||||
typedef _Ty* pointer;
|
||||
typedef _Ty const* const_pointer;
|
||||
typedef _Ty& reference;
|
||||
typedef _Ty const& const_reference;
|
||||
|
||||
|
||||
Iterator() : _Ptr(0)
|
||||
Iterator()
|
||||
: _Ptr(0)
|
||||
{ // construct with null node pointer
|
||||
}
|
||||
|
||||
Iterator(pointer _Pnode) : _Ptr(_Pnode)
|
||||
Iterator(pointer _Pnode)
|
||||
: _Ptr(_Pnode)
|
||||
{ // construct with node pointer _Pnode
|
||||
}
|
||||
|
||||
|
|
@ -229,13 +243,13 @@ class LinkedListHead
|
|||
return (_Ptr != &_Right);
|
||||
}
|
||||
|
||||
|
||||
pointer _Mynode()
|
||||
{ // return node pointer
|
||||
return (_Ptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
pointer _Ptr; // pointer to node
|
||||
};
|
||||
|
||||
|
|
@ -243,4 +257,5 @@ class LinkedListHead
|
|||
};
|
||||
|
||||
//============================================
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,21 +18,24 @@
|
|||
|
||||
#ifndef _REFMANAGER_H
|
||||
#define _REFMANAGER_H
|
||||
|
||||
//=====================================================
|
||||
|
||||
#include "Utilities/LinkedList.h"
|
||||
#include "Utilities/LinkedReference/Reference.h"
|
||||
|
||||
template <class TO, class FROM> class RefManager : public LinkedListHead
|
||||
template <class TO, class FROM>
|
||||
class RefManager : public LinkedListHead
|
||||
{
|
||||
public:
|
||||
typedef LinkedListHead::Iterator< Reference<TO, FROM> > iterator;
|
||||
RefManager() { }
|
||||
|
||||
typedef LinkedListHead::Iterator<Reference<TO, FROM> > iterator;
|
||||
RefManager() {}
|
||||
virtual ~RefManager() { clearReferences(); }
|
||||
|
||||
Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM>*) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM> *) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM> const* getFirst() const { return ((Reference<TO, FROM> const*) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM>* getLast() { return ((Reference<TO, FROM>*) LinkedListHead::getLast()); }
|
||||
Reference<TO, FROM>* getLast() { return ((Reference<TO, FROM> *) LinkedListHead::getLast()); }
|
||||
Reference<TO, FROM> const* getLast() const { return ((Reference<TO, FROM> const*) LinkedListHead::getLast()); }
|
||||
|
||||
iterator begin() { return iterator(getFirst()); }
|
||||
|
|
@ -43,7 +46,7 @@ template <class TO, class FROM> class RefManager : public LinkedListHead
|
|||
void clearReferences()
|
||||
{
|
||||
LinkedListElement* ref;
|
||||
while((ref = getFirst()) != NULL)
|
||||
while ((ref = getFirst()) != NULL)
|
||||
{
|
||||
((Reference<TO, FROM>*) ref)->invalidate();
|
||||
ref->delink(); // the delink might be already done by invalidate(), but doing it here again does not hurt and insures an empty list
|
||||
|
|
@ -52,4 +55,5 @@ template <class TO, class FROM> class RefManager : public LinkedListHead
|
|||
};
|
||||
|
||||
//=====================================================
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,12 +23,16 @@
|
|||
|
||||
//=====================================================
|
||||
|
||||
template <class TO, class FROM> class Reference : public LinkedListElement
|
||||
template<class TO, class FROM>
|
||||
class Reference : public LinkedListElement
|
||||
{
|
||||
private:
|
||||
|
||||
TO* iRefTo;
|
||||
FROM* iRefFrom;
|
||||
|
||||
protected:
|
||||
|
||||
// Tell our refTo (target) object that we have a link
|
||||
virtual void targetObjectBuildLink() = 0;
|
||||
|
||||
|
|
@ -37,17 +41,24 @@ template <class TO, class FROM> class Reference : public LinkedListElement
|
|||
|
||||
// Tell our refFrom (source) object, that the link is cut (Target destroyed)
|
||||
virtual void sourceObjectDestroyLink() = 0;
|
||||
|
||||
public:
|
||||
Reference() { iRefTo = NULL; iRefFrom = NULL; }
|
||||
|
||||
Reference()
|
||||
: iRefTo(NULL), iRefFrom(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~Reference() {}
|
||||
|
||||
// Create new link
|
||||
void link(TO* toObj, FROM* fromObj)
|
||||
{
|
||||
assert(fromObj); // fromObj MUST not be NULL
|
||||
if(isValid())
|
||||
ASSERT(fromObj); // fromObj MUST not be NULL
|
||||
if (isValid())
|
||||
unlink();
|
||||
if(toObj != NULL)
|
||||
|
||||
if (toObj != NULL)
|
||||
{
|
||||
iRefTo = toObj;
|
||||
iRefFrom = fromObj;
|
||||
|
|
@ -57,13 +68,21 @@ template <class TO, class FROM> class Reference : public LinkedListElement
|
|||
|
||||
// We don't need the reference anymore. Call comes from the refFrom object
|
||||
// Tell our refTo object, that the link is cut
|
||||
void unlink() { targetObjectDestroyLink(); delink(); iRefTo = NULL; iRefFrom = NULL; }
|
||||
void unlink()
|
||||
{
|
||||
targetObjectDestroyLink();
|
||||
delink();
|
||||
iRefTo = NULL;
|
||||
iRefFrom = NULL;
|
||||
}
|
||||
|
||||
// Link is invalid due to destruction of referenced target object. Call comes from the refTo object
|
||||
// Tell our refFrom object, that the link is cut
|
||||
void invalidate() // the iRefFrom MUST remain!!
|
||||
{
|
||||
sourceObjectDestroyLink(); delink(); iRefTo = NULL;
|
||||
sourceObjectDestroyLink();
|
||||
delink();
|
||||
iRefTo = NULL;
|
||||
}
|
||||
|
||||
bool isValid() const // Only check the iRefTo
|
||||
|
|
@ -71,21 +90,22 @@ template <class TO, class FROM> class Reference : public LinkedListElement
|
|||
return iRefTo != NULL;
|
||||
}
|
||||
|
||||
Reference<TO,FROM> * next() { return((Reference<TO,FROM> *) LinkedListElement::next()); }
|
||||
Reference<TO,FROM> const * next() const { return((Reference<TO,FROM> const *) LinkedListElement::next()); }
|
||||
Reference<TO,FROM> * prev() { return((Reference<TO,FROM> *) LinkedListElement::prev()); }
|
||||
Reference<TO,FROM> const * prev() const { return((Reference<TO,FROM> const *) LinkedListElement::prev()); }
|
||||
Reference<TO,FROM> * next() { return((Reference<TO, FROM> *) LinkedListElement::next()); }
|
||||
Reference<TO,FROM> const* next() const { return((Reference<TO, FROM> const*) LinkedListElement::next()); }
|
||||
Reference<TO,FROM> * prev() { return((Reference<TO, FROM> *) LinkedListElement::prev()); }
|
||||
Reference<TO,FROM> const* prev() const { return((Reference<TO, FROM> const*) LinkedListElement::prev()); }
|
||||
|
||||
Reference<TO,FROM> * nocheck_next() { return((Reference<TO,FROM> *) LinkedListElement::nocheck_next()); }
|
||||
Reference<TO,FROM> const * nocheck_next() const { return((Reference<TO,FROM> const *) LinkedListElement::nocheck_next()); }
|
||||
Reference<TO,FROM> * nocheck_prev() { return((Reference<TO,FROM> *) LinkedListElement::nocheck_prev()); }
|
||||
Reference<TO,FROM> const * nocheck_prev() const { return((Reference<TO,FROM> const *) LinkedListElement::nocheck_prev()); }
|
||||
Reference<TO,FROM> * nocheck_next() { return((Reference<TO, FROM> *) LinkedListElement::nocheck_next()); }
|
||||
Reference<TO,FROM> const* nocheck_next() const { return((Reference<TO, FROM> const*) LinkedListElement::nocheck_next()); }
|
||||
Reference<TO,FROM> * nocheck_prev() { return((Reference<TO, FROM> *) LinkedListElement::nocheck_prev()); }
|
||||
Reference<TO,FROM> const* nocheck_prev() const { return((Reference<TO, FROM> const*) LinkedListElement::nocheck_prev()); }
|
||||
|
||||
TO* operator ->() const { return iRefTo; }
|
||||
TO* operator->() const { return iRefTo; }
|
||||
TO* getTarget() const { return iRefTo; }
|
||||
|
||||
FROM* getSource() const { return iRefFrom; }
|
||||
};
|
||||
|
||||
//=====================================================
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,9 +35,10 @@ struct TypeList
|
|||
};
|
||||
|
||||
// enough for now.. can be expand at any point in time as needed
|
||||
#define TYPELIST_1(T1) TypeList<T1,TypeNull>
|
||||
#define TYPELIST_2(T1, T2) TypeList<T1, TYPELIST_1(T2) >
|
||||
#define TYPELIST_3(T1, T2, T3) TypeList<T1, TYPELIST_2(T2, T3) >
|
||||
#define TYPELIST_4(T1, T2, T3, T4) TypeList<T1, TYPELIST_3(T2, T3, T4) >
|
||||
#define TYPELIST_5(T1, T2, T3, T4, T5) TypeList<T1, TYPELIST_4(T2, T3, T4, T5) >
|
||||
#define TYPELIST_1(T1) TypeList<T1, TypeNull>
|
||||
#define TYPELIST_2(T1, T2) TypeList<T1, TYPELIST_1(T2) >
|
||||
#define TYPELIST_3(T1, T2, T3) TypeList<T1, TYPELIST_2(T2, T3) >
|
||||
#define TYPELIST_4(T1, T2, T3, T4) TypeList<T1, TYPELIST_3(T2, T3, T4) >
|
||||
#define TYPELIST_5(T1, T2, T3, T4, T5) TypeList<T1, TYPELIST_4(T2, T3, T4, T5) >
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -52,11 +52,14 @@ using std::hash_map;
|
|||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
template<> struct hash<unsigned long long>
|
||||
template<>
|
||||
struct hash<unsigned long long>
|
||||
{
|
||||
size_t operator()(const unsigned long long &__x) const { return (size_t)__x; }
|
||||
};
|
||||
template<typename T> struct hash<T *>
|
||||
|
||||
template<typename T>
|
||||
struct hash<T *>
|
||||
{
|
||||
size_t operator()(T * const &__x) const { return (size_t)__x; }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue