mirror of
https://github.com/mangosfour/server.git
synced 2025-12-31 13:37:07 +00:00
Various Cleanups (framework/)
This commit is contained in:
parent
8951eed780
commit
9753625fd1
23 changed files with 239 additions and 224 deletions
|
|
@ -29,19 +29,19 @@
|
|||
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);
|
||||
}
|
||||
|
||||
template<> inline void convert<0>(char *) {}
|
||||
template<> inline void convert<1>(char *) {} // ignore central byte
|
||||
template<> inline void convert<0>(char*) {}
|
||||
template<> inline void convert<1>(char*) {} // ignore central byte
|
||||
|
||||
template<typename T>
|
||||
inline void apply(T *val)
|
||||
inline void apply(T* val)
|
||||
{
|
||||
convert<sizeof(T)>((char *)(val));
|
||||
convert<sizeof(T)>((char*)(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +59,6 @@ template<typename T> void EndianConvertReverse(T*); // will generate link error
|
|||
inline void EndianConvert(uint8&) { }
|
||||
inline void EndianConvert(int8&) { }
|
||||
inline void EndianConvertReverse(uint8&) { }
|
||||
inline void EndianConvertReverse( int8&) { }
|
||||
inline void EndianConvertReverse(int8&) { }
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MaNGOS
|
|||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1, ParamType2, ParamType3, ParamType4);
|
||||
Class *m_object;
|
||||
Class* m_object;
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
ParamType2 m_param2;
|
||||
|
|
@ -64,15 +64,15 @@ namespace MaNGOS
|
|||
|
||||
public:
|
||||
|
||||
_Callback(Class *object, Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3, ParamType4 param4)
|
||||
_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)
|
||||
m_param1(param1), m_param2(param2), m_param3(param3), m_param4(param4)
|
||||
{
|
||||
}
|
||||
|
||||
_Callback(_Callback<Class, ParamType1, ParamType2, ParamType3, ParamType4> const& cb)
|
||||
: m_object(cb.m_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_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -83,7 +83,7 @@ namespace MaNGOS
|
|||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1, ParamType2, ParamType3);
|
||||
Class *m_object;
|
||||
Class* m_object;
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
ParamType2 m_param2;
|
||||
|
|
@ -91,15 +91,15 @@ namespace MaNGOS
|
|||
void _Execute() { (m_object->*m_method)(m_param1, m_param2, m_param3); }
|
||||
|
||||
public:
|
||||
_Callback(Class *object, Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
_Callback(Class* object, Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: m_object(object), m_method(method),
|
||||
m_param1(param1), m_param2(param2), m_param3(param3)
|
||||
m_param1(param1), m_param2(param2), m_param3(param3)
|
||||
{
|
||||
}
|
||||
|
||||
_Callback(_Callback<Class, ParamType1, ParamType2, ParamType3> const& cb)
|
||||
: m_object(cb.m_object), m_method(cb.m_method),
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3)
|
||||
m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -110,7 +110,7 @@ namespace MaNGOS
|
|||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1, ParamType2);
|
||||
Class *m_object;
|
||||
Class* m_object;
|
||||
Method m_method;
|
||||
ParamType1 m_param1;
|
||||
ParamType2 m_param2;
|
||||
|
|
@ -118,15 +118,15 @@ namespace MaNGOS
|
|||
|
||||
public:
|
||||
|
||||
_Callback(Class *object, Method method, ParamType1 param1, ParamType2 param2)
|
||||
_Callback(Class* object, Method method, ParamType1 param1, ParamType2 param2)
|
||||
: m_object(object), m_method(method),
|
||||
m_param1(param1), m_param2(param2)
|
||||
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_param1(cb.m_param1), m_param2(cb.m_param2)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -137,22 +137,22 @@ namespace MaNGOS
|
|||
protected:
|
||||
|
||||
typedef void (Class::*Method)(ParamType1);
|
||||
Class *m_object;
|
||||
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)
|
||||
_Callback(Class* object, Method method, ParamType1 param1)
|
||||
: m_object(object), m_method(method),
|
||||
m_param1(param1)
|
||||
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_param1(cb.m_param1)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -163,12 +163,12 @@ namespace MaNGOS
|
|||
protected:
|
||||
|
||||
typedef void (Class::*Method)();
|
||||
Class *m_object;
|
||||
Class* m_object;
|
||||
Method m_method;
|
||||
void _Execute() { (m_object->*m_method)(); }
|
||||
|
||||
public:
|
||||
_Callback(Class *object, Method method)
|
||||
_Callback(Class* object, Method method)
|
||||
: m_object(object), m_method(method)
|
||||
{
|
||||
}
|
||||
|
|
@ -197,13 +197,13 @@ namespace MaNGOS
|
|||
|
||||
_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)
|
||||
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_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3), m_param4(cb.m_param4)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -223,12 +223,12 @@ namespace MaNGOS
|
|||
public:
|
||||
_SCallback(Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: m_method(method),
|
||||
m_param1(param1), m_param2(param2), m_param3(param3)
|
||||
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_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -247,13 +247,13 @@ namespace MaNGOS
|
|||
public:
|
||||
_SCallback(Method method, ParamType1 param1, ParamType2 param2)
|
||||
: m_method(method),
|
||||
m_param1(param1), m_param2(param2)
|
||||
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_param1(cb.m_param1), m_param2(cb.m_param2)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -271,13 +271,13 @@ namespace MaNGOS
|
|||
public:
|
||||
_SCallback(Method method, ParamType1 param1)
|
||||
: m_method(method),
|
||||
m_param1(param1)
|
||||
m_param1(param1)
|
||||
{
|
||||
}
|
||||
|
||||
_SCallback(_SCallback<ParamType1> const& cb)
|
||||
: m_method(cb.m_method),
|
||||
m_param1(cb.m_param1)
|
||||
m_param1(cb.m_param1)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
@ -337,7 +337,7 @@ namespace MaNGOS
|
|||
typedef _Callback<Class, ParamType1, ParamType2, ParamType3, ParamType4> C4;
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C4::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3, ParamType4 param4)
|
||||
Callback(Class* object, typename C4::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3, ParamType4 param4)
|
||||
: _ICallback<C4>(C4(object, method, param1, param2, param3, param4))
|
||||
{
|
||||
}
|
||||
|
|
@ -351,7 +351,7 @@ namespace MaNGOS
|
|||
typedef _Callback<Class, ParamType1, ParamType2, ParamType3> C3;
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C3::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
Callback(Class* object, typename C3::Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: _ICallback<C3>(C3(object, method, param1, param2, param3))
|
||||
{
|
||||
}
|
||||
|
|
@ -365,7 +365,7 @@ namespace MaNGOS
|
|||
typedef _Callback<Class, ParamType1, ParamType2> C2;
|
||||
|
||||
public:
|
||||
Callback(Class *object, typename C2::Method method, ParamType1 param1, ParamType2 param2)
|
||||
Callback(Class* object, typename C2::Method method, ParamType1 param1, ParamType2 param2)
|
||||
: _ICallback<C2>(C2(object, method, param1, param2))
|
||||
{
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ namespace MaNGOS
|
|||
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C1::Method method, ParamType1 param1)
|
||||
Callback(Class* object, typename C1::Method method, ParamType1 param1)
|
||||
: _ICallback<C1>(C1(object, method, param1))
|
||||
{
|
||||
}
|
||||
|
|
@ -395,7 +395,7 @@ namespace MaNGOS
|
|||
|
||||
public:
|
||||
|
||||
Callback(Class *object, typename C0::Method method)
|
||||
Callback(Class* object, typename C0::Method method)
|
||||
: _ICallback<C0>(C0(object, method))
|
||||
{
|
||||
}
|
||||
|
|
@ -441,7 +441,7 @@ namespace MaNGOS
|
|||
|
||||
public:
|
||||
|
||||
QueryCallback(Class *object, typename QC3::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
QueryCallback(Class* object, typename QC3::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2, ParamType3 param3)
|
||||
: _IQueryCallback<QC3>(QC3(object, method, result, param1, param2, param3))
|
||||
{
|
||||
}
|
||||
|
|
@ -456,7 +456,7 @@ namespace MaNGOS
|
|||
|
||||
public:
|
||||
|
||||
QueryCallback(Class *object, typename QC2::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2)
|
||||
QueryCallback(Class* object, typename QC2::Method method, QueryResult* result, ParamType1 param1, ParamType2 param2)
|
||||
: _IQueryCallback<QC2>(QC2(object, method, result, param1, param2))
|
||||
{
|
||||
}
|
||||
|
|
@ -471,7 +471,7 @@ namespace MaNGOS
|
|||
|
||||
public:
|
||||
|
||||
QueryCallback(Class *object, typename QC1::Method method, QueryResult* result, ParamType1 param1)
|
||||
QueryCallback(Class* object, typename QC1::Method method, QueryResult* result, ParamType1 param1)
|
||||
: _IQueryCallback<QC1>(QC1(object, method, result, param1))
|
||||
{
|
||||
}
|
||||
|
|
@ -485,7 +485,7 @@ namespace MaNGOS
|
|||
typedef _Callback<Class, QueryResult*> QC0;
|
||||
|
||||
public:
|
||||
QueryCallback(Class *object, typename QC0::Method method, QueryResult* result)
|
||||
QueryCallback(Class* object, typename QC0::Method method, QueryResult* result)
|
||||
: _IQueryCallback<QC0>(QC0(object, method, result))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ void EventProcessor::KillAllEvents(bool force)
|
|||
delete i_old->second;
|
||||
|
||||
if (!force) // need per-element cleanup
|
||||
m_events.erase (i_old);
|
||||
m_events.erase(i_old);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@ class LinkedListElement
|
|||
bool hasPrev() const { return (iPrev->iPrev != NULL); }
|
||||
bool isInList() const { return (iNext != NULL && iPrev != NULL); }
|
||||
|
||||
LinkedListElement * next() { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement* next() { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement const* next() const { return hasNext() ? iNext : NULL; }
|
||||
LinkedListElement * prev() { return hasPrev() ? iPrev : NULL; }
|
||||
LinkedListElement* prev() { return hasPrev() ? iPrev : NULL; }
|
||||
LinkedListElement const* prev() const { return hasPrev() ? iPrev : NULL; }
|
||||
|
||||
LinkedListElement * nocheck_next() { return iNext; }
|
||||
LinkedListElement* nocheck_next() { return iNext; }
|
||||
LinkedListElement const* nocheck_next() const { return iNext; }
|
||||
LinkedListElement * nocheck_prev() { return iPrev; }
|
||||
LinkedListElement* nocheck_prev() { return iPrev; }
|
||||
LinkedListElement const* nocheck_prev() const { return iPrev; }
|
||||
|
||||
void delink()
|
||||
|
|
@ -103,10 +103,10 @@ class LinkedListHead
|
|||
|
||||
bool isEmpty() const { return (!iFirst.iNext->isInList()); }
|
||||
|
||||
LinkedListElement * getFirst() { 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* getLast() { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
LinkedListElement const* getLast() const { return (isEmpty() ? NULL : iLast.iPrev); }
|
||||
|
||||
void insertFirst(LinkedListElement* pElem)
|
||||
|
|
@ -126,7 +126,7 @@ class LinkedListHead
|
|||
uint32 result = 0;
|
||||
LinkedListElement const* e = getFirst();
|
||||
|
||||
while(e)
|
||||
while (e)
|
||||
{
|
||||
++result;
|
||||
e = e->next();
|
||||
|
|
@ -158,93 +158,108 @@ class LinkedListHead
|
|||
|
||||
Iterator()
|
||||
: _Ptr(0)
|
||||
{ // construct with null node pointer
|
||||
{
|
||||
// construct with null node pointer
|
||||
}
|
||||
|
||||
Iterator(pointer _Pnode)
|
||||
: _Ptr(_Pnode)
|
||||
{ // construct with node pointer _Pnode
|
||||
{
|
||||
// construct with node pointer _Pnode
|
||||
}
|
||||
|
||||
Iterator& operator=(Iterator const &_Right)
|
||||
Iterator& operator=(Iterator const& _Right)
|
||||
{
|
||||
return (*this) = _Right._Ptr;
|
||||
}
|
||||
|
||||
Iterator& operator=(const_pointer const &_Right)
|
||||
Iterator& operator=(const_pointer const& _Right)
|
||||
{
|
||||
_Ptr = (pointer)_Right;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
reference operator*()
|
||||
{ // return designated value
|
||||
{
|
||||
// return designated value
|
||||
return *_Ptr;
|
||||
}
|
||||
|
||||
pointer operator->()
|
||||
{ // return pointer to class object
|
||||
{
|
||||
// return pointer to class object
|
||||
return _Ptr;
|
||||
}
|
||||
|
||||
Iterator& operator++()
|
||||
{ // preincrement
|
||||
{
|
||||
// preincrement
|
||||
_Ptr = _Ptr->next();
|
||||
return (*this);
|
||||
}
|
||||
|
||||
Iterator operator++(int)
|
||||
{ // postincrement
|
||||
{
|
||||
// postincrement
|
||||
iterator _Tmp = *this;
|
||||
++*this;
|
||||
return (_Tmp);
|
||||
}
|
||||
|
||||
Iterator& operator--()
|
||||
{ // predecrement
|
||||
{
|
||||
// predecrement
|
||||
_Ptr = _Ptr->prev();
|
||||
return (*this);
|
||||
}
|
||||
|
||||
Iterator operator--(int)
|
||||
{ // postdecrement
|
||||
{
|
||||
// postdecrement
|
||||
iterator _Tmp = *this;
|
||||
--*this;
|
||||
return (_Tmp);
|
||||
}
|
||||
|
||||
bool operator==(Iterator const &_Right) const
|
||||
{ // test for iterator equality
|
||||
bool operator==(Iterator const& _Right) const
|
||||
{
|
||||
// test for iterator equality
|
||||
return (_Ptr == _Right._Ptr);
|
||||
}
|
||||
|
||||
bool operator!=(Iterator const &_Right) const
|
||||
{ // test for iterator inequality
|
||||
bool operator!=(Iterator const& _Right) const
|
||||
{
|
||||
// test for iterator inequality
|
||||
return (!(*this == _Right));
|
||||
}
|
||||
|
||||
bool operator==(pointer const &_Right) const
|
||||
{ // test for pointer equality
|
||||
bool operator==(pointer const& _Right) const
|
||||
{
|
||||
// test for pointer equality
|
||||
return (_Ptr != _Right);
|
||||
}
|
||||
|
||||
bool operator!=(pointer const &_Right) const
|
||||
{ // test for pointer equality
|
||||
bool operator!=(pointer const& _Right) const
|
||||
{
|
||||
// test for pointer equality
|
||||
return (!(*this == _Right));
|
||||
}
|
||||
|
||||
bool operator==(const_reference _Right) const
|
||||
{ // test for reference equality
|
||||
{
|
||||
// test for reference equality
|
||||
return (_Ptr == &_Right);
|
||||
}
|
||||
|
||||
bool operator!=(const_reference _Right) const
|
||||
{ // test for reference equality
|
||||
{
|
||||
// test for reference equality
|
||||
return (_Ptr != &_Right);
|
||||
}
|
||||
|
||||
pointer _Mynode()
|
||||
{ // return node pointer
|
||||
{
|
||||
// return node pointer
|
||||
return (_Ptr);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ class RefManager : public LinkedListHead
|
|||
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()); }
|
||||
|
|
|
|||
|
|
@ -90,14 +90,14 @@ class Reference : public LinkedListElement
|
|||
return iRefTo != NULL;
|
||||
}
|
||||
|
||||
Reference<TO,FROM> * next() { return((Reference<TO, FROM> *) LinkedListElement::next()); }
|
||||
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>* 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>* 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>* 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; }
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ template<class K>
|
|||
class hash
|
||||
{
|
||||
public:
|
||||
size_t operator() (K const&);
|
||||
size_t operator()(K const&);
|
||||
};
|
||||
|
||||
HASH_NAMESPACE_END
|
||||
|
|
@ -100,27 +100,27 @@ using std::hash_set;
|
|||
|
||||
HASH_NAMESPACE_START
|
||||
|
||||
template<>
|
||||
class hash<unsigned long long>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const unsigned long long &__x) const { return (size_t)__x; }
|
||||
};
|
||||
template<>
|
||||
class hash<unsigned long long>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const unsigned long long& __x) const { return (size_t)__x; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class hash<T *>
|
||||
{
|
||||
public:
|
||||
size_t operator()(T * const &__x) const { return (size_t)__x; }
|
||||
};
|
||||
template<typename T>
|
||||
class hash<T*>
|
||||
{
|
||||
public:
|
||||
size_t operator()(T* const& __x) const { return (size_t)__x; }
|
||||
};
|
||||
|
||||
template<> struct hash<std::string>
|
||||
template<> struct hash<std::string>
|
||||
{
|
||||
size_t operator()(const std::string& __x) const
|
||||
{
|
||||
size_t operator()(const std::string &__x) const
|
||||
{
|
||||
return hash<const char *>()(__x.c_str());
|
||||
}
|
||||
};
|
||||
return hash<const char*>()(__x.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
HASH_NAMESPACE_END
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue