Files
envi-code/SourceCode/Code2026/inc/AdsXRx/XPushMemVar.h
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

45 lines
823 B
C++

//-----------------------------------------------------------------------------+
// Copyright (C), 1998-2007, SH Software Co. Ltd.
// = FileName : XPushMemVar.h
// = Version : ver2.0
// = Author : zjq
// = CreateDate : 2002-09-09
// = Description: 类的声明
// = Maintainers:
//
//-----------------------------------------------------------------------------+
#ifndef _XPushMemVar_H_
#define _XPushMemVar_H_
template <class T>
class XPushMemVar
{
public:
XPushMemVar(T &var, const T &val);
~XPushMemVar() ;
protected:
T *m_pVarBackup;
T m_valBackup;
};
template <class T>
XPushMemVar<T>::XPushMemVar(T &var, const T &val)
{
m_pVarBackup = &var;
m_valBackup = var;
var = val;
}
template <class T>
XPushMemVar<T>::~XPushMemVar()
{
*m_pVarBackup = m_valBackup;
}
#endif