x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
SVector.h - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\scintilla\src\SVector.h
旋转
特效
属性
历史版本
// Scintilla source code edit control /** @file SVector.h ** A simple expandable vector. **/ // Copyright 1998-2001 by Neil Hodgson
// The License.txt file describes the conditions under which this software may be distributed. #ifndef SVECTOR_H #define SVECTOR_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif /** * A simple expandable integer vector. * Storage not allocated for elements until an element is used. * This makes it very lightweight unless used so is a good match for optional features. */ class SVector { enum { allocSize = 4000 }; int *v; ///< The vector unsigned int size; ///< Number of elements allocated unsigned int len; ///< Number of elements used in vector bool allocFailure; ///< A memory allocation call has failed /** Internally allocate more elements than the user wants * to avoid thrashing the memory allocator. */ void SizeTo(int newSize) { if (newSize < allocSize) newSize += allocSize; else newSize = (newSize * 3) / 2; int* newv = new int[newSize]; if (!newv) { allocFailure = true; return; } size = newSize; unsigned int i=0; for (; i
0) { SizeTo(other.Length()); if (!allocFailure) { for (int i=0;i
0) { SizeTo(other.Length()); if (!allocFailure) { for (int i=0;i
= len) { if (i >= size) { SizeTo(i); } len = i+1; } return v[i]; } /// Reset vector. void Free() { delete []v; v = 0; size = 0; len = 0; } /** @brief Grow vector size. * Doesn't allow a vector to be shrinked. */ void SetLength(unsigned int newLength) { if (newLength > len) { if (newLength >= size) { SizeTo(newLength); } } len = newLength; } /// Get the current length (number of used elements) of the vector. int Length() const { return len; } }; #ifdef SCI_NAMESPACE } #endif #endif
SVector.h
网页地址
文件地址
上一页
115/122
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.