⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wrapper.h

📁 常用树数据结构集合
💻 H
字号:
#ifndef WRAPPER_H_#define WRAPPER_H_#include <stdlib.h>#include "Except.h"// Class that wraps a constant reference variable.// Useful for return value from a container find method.template <class Object>class Cref{  public:    Cref( ) : obj( NULL ) { }    explicit Cref( const Object & x ) : obj( &x ) { }    const Object & get( ) const      { if( isNull( ) ) throw NullPointerException( ); else return *obj; }    bool isNull( ) const      { return obj == NULL; }  private:    const Object *obj;};// Class that wraps a pointer variable for sorting.template <class Comparable>class Pointer{  public:    explicit Pointer( Comparable *rhs = NULL ) : pointee( rhs ) { }    bool operator<( const Pointer & rhs ) const      { return *pointee < *rhs.pointee; }    operator Comparable * ( ) const      { return pointee; }    Comparable * get( ) const      { return pointee; }  private:    Comparable *pointee;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -