📄 warsimpleptrwrapper.h
字号:
/** Simple pointer wrapper for STL containers. Similar to \Ref{WarSmartPointer}, but without the need for a dedicated item base class. No automatic handling of object destruction.*/#ifndef WAR_SIMPLE_PTR_WRAPPER_H#define WAR_SIMPLE_PTR_WRAPPER_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES *//* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplustemplate <class T>class WarSimplePtrWrapper {public: // LIFECYCLE /** Constructor */ WarSimplePtrWrapper(T *pPtr) : mpPtr(pPtr) {} /** Constructor */ WarSimplePtrWrapper(const WarSimplePtrWrapper& from) : mpPtr(from.mpPtr) {} /** Constructor */ WarSimplePtrWrapper& operator = (const WarSimplePtrWrapper& from) { mpPtr = from.mpPtr; } // OPERATORS inline bool operator == (const WarSimplePtrWrapper& from) const { return *mpPtr == *from.mpPtr; } inline bool operator < (const WarSimplePtrWrapper& from) const { return *mpPtr < *from.mpPtr; } /** Returns the object pointed to by the proiner */ inline operator T&() { return *mpPtr; } // OPERATIONS // ACCESS /** Returns the object pointed to by the proiner */ inline T& Data() { return *mpPtr; } /** Returns the object pointed to by the proiner */ inline const T& Data() const { return *mpPtr; } // INQUIRY protected:private: T *mpPtr;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif /* WAR_SIMPLE_PTR_WRAPPER_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -