?? callback.cpp
字號:
#include "callback.h"
BEGIN_DTL_NAMESPACE
#if 0
//putting this here actually prevented some optimizations, so still inline
CBFunctorBase::CBFunctorBase(const void *c,_Func f, const void *mf,size_t sz)
{
if(c) //must be callee/memfunc
{
callee = (void *)c;
memcpy(memFunc,mf,sz);
if(sz<MEM_FUNC_SIZE) //zero-out the rest if any, so comparisons work
{
memset(memFunc+sz,0,MEM_FUNC_SIZE-sz);
}
}
else //must be ptr-to-func
{
func = f;
}
}
#endif
RHCB_BOOL operator==(const CBFunctorBase &lhs,const CBFunctorBase &rhs)
{
if(!lhs.callee)
{
if(rhs.callee)
return RHCB_FALSE;
return lhs.func == rhs.func;
}
else
{
if(!rhs.callee)
return RHCB_FALSE;
return lhs.callee == rhs.callee &&
!memcmp(lhs.memFunc,rhs.memFunc,CBFunctorBase::MEM_FUNC_SIZE);
}
}
RHCB_BOOL operator!=(const CBFunctorBase &lhs,const CBFunctorBase &rhs)
{
return !operator==(lhs,rhs);
}
RHCB_BOOL operator<(const CBFunctorBase &lhs,const CBFunctorBase &rhs)
{
//must order across funcs and callee/memfuncs, funcs are first
if(!lhs.callee)
{
if(rhs.callee)
return RHCB_TRUE;
else
return lhs.func < rhs.func;
}
else
{
if(!rhs.callee)
return RHCB_FALSE;
if(lhs.callee != rhs.callee)
return lhs.callee < rhs.callee;
else
return memcmp(lhs.memFunc,rhs.memFunc,CBFunctorBase::MEM_FUNC_SIZE)<0;
}
}
END_DTL_NAMESPACE
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -