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

📄 xcept.h

📁 潜在语义准备
💻 H
字号:
// File:	 xcept.h
//
// Purpose:  Exeption classes for various error types
// Author:   Sartaj Shani, in Data Structures, Algorithms and Applications
//                    in C++, McGraw Hill (1998).  
//
// Note:     Required for matrix.h 
//
// For more details please see my BComp(Hons) thesis at www.pcug.org.au/~jdowling


// exception classes for various error types

#ifndef Xcept_
#define Xcept_

#include <new.h>

// bad initializers
class BadInitializers {
   public:
      BadInitializers() {}
};

// insufficient memory
class NoMem {
   public:
      NoMem() {}
};

// change new to throw NoMem instead of standard behavior
// Visual C++ requires following form of my_new_handler
int my_new_handler(size_t x)
{
   throw NoMem();
   // even though the following statement is unreachable,
   // visual C++ will not compile successfully without it
   return 0;
};

_PNH Old_Handler_ = _set_new_handler(my_new_handler);

// improper array, find, insert, or delete index
// or deletion from empty structure
class OutOfBounds {
   public:
      OutOfBounds() {}
};

// use when operands should have matching size
class SizeMismatch {
   public:
      SizeMismatch() {}
};

// use when zero was expected
class MustBeZero {
   public:
      MustBeZero() {}
};

// use when zero was expected
class BadInput {
   public:
      BadInput() {}
};

#endif

⌨️ 快捷键说明

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