fe_vector.h

来自「这是一个语音特征提取的程序源码」· C头文件 代码 · 共 64 行

H
64
字号
///////////////////////////////////////////////////////////////////////////////
// This is a part of the Feature program.
// Version: 1.0
// Date: February 22, 2003
// Programmer: Oh-Wook Kwon
// Copyright(c) 2003 Oh-Wook Kwon. All rights reserved. owkwon@ucsd.edu
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// This class provides bound-checking capability to the vector container.
// Only works in the debug mode.
///////////////////////////////////////////////////////////////////////////////

#ifndef _VECTOR_DEBUG_H_#define _VECTOR_DEBUG_H_
#pragma warning(disable:4786)
#include <vector>
using namespace std;

#ifdef _DEBUG#include <assert.h>template <typename T>class vectorDebug__ : public vector<T> {public:	vectorDebug__(int n=0) : vector<T>(n) {}	const T& operator[](int i) const;	T& operator[](int i);};template <typename T> const T& vectorDebug__<T>::operator[](int i) const{	if(i < 0 || i >= this->size()){		int n=this->size();		fprintf(stderr, "ERROR: vector bound error (index=%d)\n", n);		assert(0);	}	return ((vector<T> *)this)->operator[](i);}template <typename T> T& vectorDebug__<T>::operator[](int i){	if(i < 0 || i >= this->size()){		int n=this->size();		fprintf(stderr, "ERROR: vector bound error (index=%d)\n", n);		assert(0);	}	return ((vector<T> *)this)->operator[](i);}#define vector vectorDebug__#endif#endif

⌨️ 快捷键说明

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