bellsmacrosx.h
来自「Data Replication Prototype Using ADO」· C头文件 代码 · 共 83 行
H
83 行
// BellsMacrosX.h : header file
//
#ifndef __BELLS_MACROS_X__H__
#define __BELLS_MACROS_X__H__
/////////////////////////////////////////////////////////////////////////////
struct DeleteSecond
{
template<typename T> void operator ()(const T& r) const
{
delete r.second;
}
};
/////////////////////////////////////////////////////////////////////////////
#ifdef _DEBUG
template<int v> struct Int2Type_
{
enum { value = v };
};
template<class T> struct HasVirtualTable_
{
class X : public T
{
X();
virtual void dummy();
};
enum { has_table = sizeof(X) == sizeof(T) };
};
template<typename T> inline void AssertVTable(const void* pData, T)
{
ASSERT(AfxIsValidAddress(
*static_cast<const void*const*>(pData), sizeof(void*), FALSE));
}
inline void AssertVTable(const void*, Int2Type_<0>) {}
template<class T> inline void AssertValidPointer(const T* pData, ...)
{
if(AfxIsValidAddress(pData, sizeof(T)))
AssertVTable(pData, Int2Type_<HasVirtualTable_<T>::has_table>());
else
ASSERT(0);
}
template<class T> inline void AssertValidPointer(const T* pOb, const CObject*)
{
if(AfxIsValidAddress(pOb, sizeof(T)))
if(AfxIsValidAddress(*reinterpret_cast<const void*const*>(pOb), sizeof(void*), FALSE))
pOb->AssertValid();
else
ASSERT(0);
else
ASSERT(0);
}
template<class T> inline void CHECK_ADDRESS(const T* pData)
{
AssertValidPointer(pData, pData);
}
template<class T> inline void CHECK_NULL_OR_ADDRESS(const T* pData)
{
if(NULL != pData)
AssertValidPointer(pData, pData);
}
#else
#define CHECK_ADDRESS(pData) static_cast<void>(0)
#define CHECK_NULL_OR_ADDRESS(pData) static_cast<void>(0)
#endif//_DEBUG
#endif
/////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?