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

📄 vcl_memory.h

📁 DTMK软件开发包,此为开源软件,是一款很好的医学图像开发资源.
💻 H
字号:
#ifndef vcl_win32_vc60_memory_h_
#define vcl_win32_vc60_memory_h_

#include "../iso/vcl_memory.h"

#undef vcl_auto_ptr

// Visual Studio 6 does not provide a correct implementation of
// auto_ptr.  This implementation is taken directly from the interface
// outlined in the 1998 C++ Standard. -- Brad King

// C++98 Standard Section 20.4.5 - Template class auto_ptr.
template <class X>
class vcl_auto_ptr
{
  template <class Y> struct auto_ptr_ref
  {
    vcl_auto_ptr<Y>& p_;
    auto_ptr_ref(vcl_auto_ptr<Y>& p): p_(p) {}
  };
  X* x_;
public:
  typedef X element_type;

  template <class Y>
  vcl_auto_ptr(vcl_auto_ptr<Y>& a) throw(): x_(a.release()) {}
  template <class Y>
  vcl_auto_ptr& operator=(vcl_auto_ptr<Y>& a) throw()
    { reset(a.release()); return *this; }

  explicit vcl_auto_ptr(X* p=0) throw(): x_(p) {}
  vcl_auto_ptr(vcl_auto_ptr& a) throw(): x_(a.release()) {}
  vcl_auto_ptr& operator=(vcl_auto_ptr& a) throw() { reset(a.release()); return *this; }
  ~vcl_auto_ptr() throw() { delete get(); }

  X& operator*() const throw() { return *get(); }
  X* operator->() const throw() { return get(); }
  X* get() const throw() { return x_; }
  X* release() throw() { X* x = x_; x_ = 0; return x; }
  void reset(X* p=0) throw() { if(get() != p) { delete get(); x_ = p; } }

  vcl_auto_ptr(auto_ptr_ref<X> r) throw(): x_(r.p_.release()) {}
  template <class Y> operator auto_ptr_ref<Y>() throw() { return *this; }
  template <class Y> operator vcl_auto_ptr<Y>() throw() { return release(); }
  vcl_auto_ptr& operator=(auto_ptr_ref<X> r) throw() { x_ = r.p_.release(); return *this; }
};

#endif

⌨️ 快捷键说明

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