您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Deallocate函数代码示例

51自学网 2021-06-01 20:25:38
  C++
这篇教程C++ Deallocate函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中Deallocate函数的典型用法代码示例。如果您正苦于以下问题:C++ Deallocate函数的具体用法?C++ Deallocate怎么用?C++ Deallocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了Deallocate函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Deallocate

moDMatrix<Real>& moDMatrix<Real>::operator= (const moDMatrix& rkM){    if (rkM.m_iQuantity > 0)    {        if (m_iRows != rkM.m_iRows || m_iCols != rkM.m_iCols)        {            Deallocate();            m_iRows = rkM.m_iRows;            m_iCols = rkM.m_iCols;            m_iQuantity = rkM.m_iQuantity;            Allocate(false);        }        for (int iRow = 0; iRow < m_iRows; iRow++)        {            for (int iCol = 0; iCol < m_iCols; iCol++)            {                m_aafEntry[iRow][iCol] = rkM.m_aafEntry[iRow][iCol];            }        }    }    else    {        Deallocate();        m_iRows = 0;        m_iCols = 0;        m_iQuantity = 0;        m_afData = 0;        m_aafEntry = 0;    }    return *this;}
开发者ID:moldeo,项目名称:libmoldeo,代码行数:31,


示例2: delete1

BSplineBasis<Real>::~BSplineBasis (){	delete1(mKnot);	Deallocate(mBD0);	Deallocate(mBD1);	Deallocate(mBD2);	Deallocate(mBD3);}
开发者ID:ascetic85,项目名称:Phoenix3d,代码行数:8,


示例3: new

Adventure::ITexture* Adventure::Image::LoadTgaFromFile(File& file, IDisplay& display, Allocator* scratch){	file.GetStream().seekg(2, std::ios::beg);		File::UInt8 type;	file.Read(type);		if (type != 2) // Type 2 indicates a regular image		return NULL;		file.GetStream().seekg(12, std::ios::beg);		File::UInt16 width, height;	file.Read(width);	file.Read(height);		int pixels = width * height;		file.GetStream().seekg(16, std::ios::beg);		File::UInt8 bits;	file.Read(bits);		if (bits < 24)		return NULL;		file.GetStream().seekg(18, std::ios::beg);		Color* pixelData = new(scratch) Color[pixels];		for (int i = 0; i < pixels; i++)	{		// BGRA format		file.Read(pixelData[i].Blue);		file.Read(pixelData[i].Green);		file.Read(pixelData[i].Red);				if (bits == 32)			file.Read(pixelData[i].Alpha);		else			pixelData[i].Alpha = Color::MaxChannelValue;	}		ITexture* texture = display.CreateTexture();		if (texture == NULL)	{		Deallocate(pixelData, scratch);		return NULL;	}		texture->SetData(pixelData, width, height, ITexture::Rgba8, ITexture::Point);		Deallocate(pixelData, scratch);			return texture;}
开发者ID:aaronbolyard,项目名称:Egoboo-Wii,代码行数:57,


示例4: Deallocate

template <class T> void Vector<T>::CopyToSelf(Vector const & source){	UInt length;	ConstElement *it, *source_it, *source_end;	Deallocate();	_ctorMode = source._ctorMode;	if(!source.IsEmpty())	{		length = source.Length();		Allocate(length);		it = _origin;		source_it = source.Begin();		source_end = source.End();		if(_ctorMode != CtorModeEnum::Always)		{			Memory::Move((VoidPtr)source_it, (VoidPtr)it, sizeof(Element) * length);			_last += length;		}		else			while(source_it != source_end)			{				Construct(it++, source_it++);				++_last;			}	}}
开发者ID:Karkasos,项目名称:Core,代码行数:30,


示例5: LOG

voidMediaEngineWebRTCVideoSource::Shutdown(){  LOG((__FUNCTION__));  if (!mInitDone) {    return;  }#ifdef MOZ_B2G_CAMERA  ReentrantMonitorAutoEnter sync(mCallbackMonitor);#endif  if (mState == kStarted) {    while (!mSources.IsEmpty()) {      Stop(mSources[0], kVideoTrack); // XXX change to support multiple tracks    }    MOZ_ASSERT(mState == kStopped);  }  if (mState == kAllocated || mState == kStopped) {    Deallocate();  }#ifndef MOZ_B2G_CAMERA  mViECapture->Release();  mViERender->Release();  mViEBase->Release();#endif  mState = kReleased;  mInitDone = false;}
开发者ID:Gabuzo,项目名称:mozilla-central,代码行数:28,


示例6: Deallocate

	void EpsilonVor::ReadIt(std::ifstream & fin){		Matrix co0,oc0;		fin.read((char *) &nnx, sizeof nnx);		fin.read((char *) &nny, sizeof nny);		fin.read((char *) &nnz, sizeof nnz);		fin.read((char *) &co0, sizeof co0);		fin.read((char *) &oc0, sizeof oc0);		fin.read((char *) &nresid, sizeof nresid);		Deallocate();		is_xRefset=true;		is_COset=true;		setMetric(co0);		Allocate();		int ntoken;		fin.read((char *) &ntoken, sizeof ntoken);		char * css=new char [ntoken];		fin.read(css, (sizeof css[0])*ntoken);		string token(css);		ResLabel.clear();		boost::split(ResLabel,token, boost::is_any_of("/t "));		fin.read((char *) &TotalCount, sizeof TotalCount);		fin.read((char *) &M_avg[0], (sizeof M_avg[0])*DIM);		fin.read((char *) &VoroVol[0], (sizeof VoroVol[0])*nresid);		fin.read((char *) &D[0][0][0], (sizeof D[0][0][0])*DIM*DIM*nresid);		fin.read((char *) &G[0][0][0], (sizeof G[0][0][0])*DIM*DIM*nresid);		fin.read((char *) &M[0][0], (sizeof M[0][0])*DIM*nresid);		fin.read((char *) &E[0][0], (sizeof E[0][0])*DIM*nresid);	}
开发者ID:mm148881,项目名称:postnoneqx,代码行数:30,


示例7: Deallocate

void Path :: Deallocate (Entry *  good){        if (good != NULL){        Deallocate (good -> next);        delete good;    }}
开发者ID:Jfeng3,项目名称:CS106B---Stanford,代码行数:7,


示例8: Deallocate

void DoublyLinkedListPriorityQueue:: Deallocate (Entry * & list){        if (list != NULL){        Deallocate (list -> next);        delete list;    }}
开发者ID:Jfeng3,项目名称:CS106B---Stanford,代码行数:7,


示例9: Deallocate

void TileGrid2D::Resize(Vector2i newSize){	std::cout<<"/nTileGrid2D::Resize";	Deallocate();	size = newSize;	/// Space in X between the columns, use for creating hexagonal grids, since the distance between each tile should always be 1.0 if possible.	float spaceX = 0;	/// Offset in Y, used for creating hexagonal grids.	Vector2f eachOtherRowOffset;	Vector2f rowSpacing(1,1);	if (gridType == GridType::HEXAGONS)	{		eachOtherRowOffset = Vector2f(0.5f, 0);		rowSpacing = Vector2f(1, 0.86602540378f);	}	for (int y = 0; y < size[1]; ++y)	{		List<Tile*> * list = new List<Tile*>();		for (int x = 0; x < size[0]; ++x)		{			Tile * tile = new Tile();			tile->position = rowSpacing.ElementMultiplication(Vector2f(x,y));			if (y % 2 == 0)				tile->position += eachOtherRowOffset;			list->Add(tile);		}		tiles.Add(list);	}}
开发者ID:erenik,项目名称:engine,代码行数:30,


示例10: Deallocate

void	CARingBuffer::Allocate(int nChannels, UInt32 bytesPerFrame, UInt32 capacityFrames){	Deallocate();		//capacityFrames = NextPowerOfTwo(capacityFrames);		mNumberChannels = nChannels;	mBytesPerFrame = bytesPerFrame;	mCapacityFrames = capacityFrames;	//mCapacityFramesMask = capacityFrames - 1;	mCapacityBytes = bytesPerFrame * capacityFrames;	// put everything in one memory allocation, first the pointers, then the deinterleaved channels	UInt32 allocSize = (mCapacityBytes + sizeof(Byte *)) * nChannels;	Byte *p = (Byte *)CA_malloc(allocSize);	memset(p, 0, allocSize);	mBuffers = (Byte **)p;	p += nChannels * sizeof(Byte *);	for (int i = 0; i < nChannels; ++i) {		mBuffers[i] = p;		p += mCapacityBytes;	}		for (UInt32 i = 0; i<kGeneralRingTimeBoundsQueueSize; ++i)	{		mTimeBoundsQueue[i].mStartTime = 0;		mTimeBoundsQueue[i].mEndTime = 0;		mTimeBoundsQueue[i].mUpdateCounter = 0;	}	mTimeBoundsQueuePtr = 0;}
开发者ID:kybernetyk,项目名称:SSUIKit,代码行数:31,


示例11: Deallocate

void CTexture::Allocate( int width, int height, int ctype ){if ( (m_width == width) && (m_height == height) && (m_type == ctype) )	return;Deallocate();TextureGetSize( ctype, &m_compsize, &m_pixelsize, &m_nelements );if ( m_compsize == 0 || m_pixelsize == 0 || m_nelements == 0)     // Sanity check 	{	printf ("CTexture::Allocate - Unknown format %08X/n", ctype );  return;	}m_width  = width;m_height = height;m_area   = width * height;m_type   = ctype;m_size   = m_area * m_pixelsize;m_pdata  = new TEXBYTE[m_size];m_pitch  = m_pixelsize * m_width;if ( ctype == TEX_PALETTE )		m_pcolormap = new colmap4f[256];}
开发者ID:mistalro,项目名称:gpufractal,代码行数:28,


示例12: LOG

voidMediaEngineWebRTCVideoSource::Shutdown(){  LOG((__FUNCTION__));  if (!mInitDone) {    return;  }  if (mState == kStarted) {    SourceMediaStream *source;    bool empty;    while (1) {      {        MonitorAutoLock lock(mMonitor);        empty = mSources.IsEmpty();        if (empty) {          break;        }        source = mSources[0];      }      Stop(source, kVideoTrack); // XXX change to support multiple tracks    }    MOZ_ASSERT(mState == kStopped);  }  if (mState == kAllocated || mState == kStopped) {    Deallocate();  }  mViECapture = nullptr;  mViERender = nullptr;  mViEBase = nullptr;  mState = kReleased;  mInitDone = false;}
开发者ID:nafis-sadik,项目名称:gecko-dev,代码行数:35,


示例13: Deallocate

void	FSTCARingBuffer::AllocateWithABL(const AudioBufferList *abl)								// Assumes floating-point data{	Deallocate();		if(abl->mNumberBuffers == 0)		return;		UInt32 idx, byteSize = offsetof(AudioBufferList, mBuffers[0]) + (sizeof(AudioBuffer) * abl->mNumberBuffers);	mBufferList = (AudioBufferList *)malloc(byteSize);	memset(mBufferList, 0, byteSize);		mBufferList->mNumberBuffers = abl->mNumberBuffers;	for(idx=0; idx<mBufferList->mNumberBuffers; idx++)	{		mBufferList->mBuffers[idx].mNumberChannels = abl->mBuffers[idx].mNumberChannels;		mBufferList->mBuffers[idx].mDataByteSize = abl->mBuffers[idx].mDataByteSize;		mBufferList->mBuffers[idx].mData = malloc(mBufferList->mBuffers[idx].mDataByteSize);	}		mCapacityFrames = abl->mBuffers[0].mDataByteSize/abl->mBuffers[0].mNumberChannels/sizeof(float);		for (UInt32 i = 0; i<kFSTGeneralRingTimeBoundsQueueSize; ++i)	{		mTimeBoundsQueue[i].mStartTime = 0;		mTimeBoundsQueue[i].mEndTime = 0;		mTimeBoundsQueue[i].mUpdateCounter = 0;	}	mTimeBoundsQueuePtr = 0;}
开发者ID:TannerPlauche,项目名称:VowelViz-Standard-iOS,代码行数:29,


示例14: LOG

voidMediaEngineGonkVideoSource::Shutdown(){  LOG((__FUNCTION__));  if (!mInitDone) {    return;  }  ReentrantMonitorAutoEnter sync(mCallbackMonitor);  if (mState == kStarted) {    SourceMediaStream *source;    bool empty;    while (1) {      {        MonitorAutoLock lock(mMonitor);        empty = mSources.IsEmpty();        if (empty) {          break;        }        source = mSources[0];      }      Stop(source, kVideoTrack); // XXX change to support multiple tracks    }    MOZ_ASSERT(mState == kStopped);  }  if (mState == kAllocated || mState == kStopped) {    Deallocate();  }  mState = kReleased;  mInitDone = false;}
开发者ID:nafis-sadik,项目名称:gecko-dev,代码行数:35,


示例15: Deallocate

bool tTexture::LoadImage(std::string filename) {	//This function uses the surface to load an image, then create a texture out of it	Deallocate();	//Create a "Guinna Pig" texture	SDL_Texture* thePig = NULL;	//Load a BMP into theSurface. BMP Is the only file type that native SDL2 can import. W(e will have to add SDL2_image to import other formats)	theSurface = SDL_LoadBMP(filename.c_str()); //SDL_LoadBMP expects a ( char[] )	//Debug VV	if(theSurface == NULL) {		std::cout << "Could not Load image! : " << SDL_GetError() <<std::endl;	} else {		//theTexture = SDL_CreateTextureFromSurface(theRenderer, theSurface);		thePig = SDL_CreateTextureFromSurface(theRenderer, theSurface);		//Debug VV		if(thePig == NULL) {			std::cout << "Could not create texture! : " << SDL_GetError() <<std::endl;		}		//Set the height and width. -> ->(Remember that theSurface is a pointer)		tWidth = theSurface->w;		tHeight = theSurface->h;		//We are going to recycle our global "Surface"		SDL_FreeSurface(theSurface);		theSurface = NULL;	}	//Here is where we copy thePig into sTexture: If anything went wrong, thePig would have been NULL	sTexture = thePig;	return sTexture != NULL;}
开发者ID:ChillieDude,项目名称:TixTaxToo,代码行数:35,


示例16: LOG

voidMediaEngineRemoteVideoSource::Shutdown(){  LOG((__PRETTY_FUNCTION__));  if (!mInitDone) {    return;  }  if (mState == kStarted) {    SourceMediaStream *source;    bool empty;    while (1) {      {        MonitorAutoLock lock(mMonitor);        empty = mSources.IsEmpty();        if (empty) {          MOZ_ASSERT(mPrincipalHandles.IsEmpty());          break;        }        source = mSources[0];      }      Stop(source, kVideoTrack); // XXX change to support multiple tracks    }    MOZ_ASSERT(mState == kStopped);  }  for (auto& registered : mRegisteredHandles) {    MOZ_ASSERT(mState == kAllocated || mState == kStopped);    Deallocate(registered.get());  }  MOZ_ASSERT(mState == kReleased);  Super::Shutdown();  mInitDone = false;}
开发者ID:bgrins,项目名称:gecko-dev,代码行数:35,


示例17: RUNTIME_ERROR

void CMTDHistory::SetCoordinate(unsigned int id,                                const CSmallString& name,                                const CSmallString& type,                                double min_value,double max_value,unsigned int nbins){    if( Sizes == NULL ){        RUNTIME_ERROR("Sizes is NULL");    }    if( id < 0 || id >= NCoords ){        INVALID_ARGUMENT("id out-of-range");    }    if( nbins <= 0 ){        INVALID_ARGUMENT("nbins <= 0");    }    if( max_value < min_value ){        INVALID_ARGUMENT("max_value < min_value");    }    if(Buffers.NumOfMembers() > 0) {        // it was already finalized - destroy data        Deallocate();    }    Sizes[id].Type = type;    Sizes[id].Name = name;    Sizes[id].MinValue = min_value;    Sizes[id].MaxValue = max_value;    Sizes[id].NBins = nbins;    Sizes[id].BinWidth = (Sizes[id].MaxValue - Sizes[id].MinValue)/Sizes[id].NBins;    Sizes[id].Width = Sizes[id].MaxValue - Sizes[id].MinValue;}
开发者ID:kulhanek,项目名称:pmflib,代码行数:34,


示例18: Deallocate

void CMTDHistory::SetPVector(const CSimpleVector<double>& pvector){    unsigned int   curr_position = 0;    CMTDBuffer*    p_buff = NULL;    int            loc = 0;    Deallocate();    while(loc < pvector.GetLength()) {        if((p_buff == NULL) || (curr_position >= MaxBufferSize)) {            // allocate new buffer            p_buff = GetNewBuffer(MaxBufferSize);            curr_position = 0;        }        // now set height        p_buff->SetHeight(curr_position,pvector[loc++]);        for(unsigned int i=0; i < GetNumberOfCoords(); i++) {            // set value and width            p_buff->SetValue(curr_position,i,pvector[loc++]);            p_buff->SetWidth(curr_position,i,pvector[loc++]);        }        p_buff->IncNumberOfHills();        curr_position++;    }}
开发者ID:kulhanek,项目名称:pmflib,代码行数:28,


示例19: sizeof

Vertex Centroid::Run(int width, int height, Vertices vertices) {  int required_bytes = sizeof(float) * width * height;  if (bytes_ < required_bytes) {    bytes_ = required_bytes;    for (int n = 0; n < 4; n++) {      if (buffer_[n] != NULL)        Deallocate((void*)buffer_[n]);      Allocate((void**)&(buffer_[n]), bytes_);    }  }  CentroidKernel(width, height, vertices, buffer_);  // Compute Centroid  Vertex center;  int count;  center.x = Reduce(width * height, buffer_[0]);  center.y = Reduce(width * height, buffer_[1]);  center.z = Reduce(width * height, buffer_[2]);  count = Reduce(width * height, buffer_[3]);  center.x /= count;  center.y /= count;  center.z /= count;  return center;}
开发者ID:BenJamesbabala,项目名称:Depth-Image-Processing,代码行数:31,



注:本文中的Deallocate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Debug3函数代码示例
C++ Deactivate函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。