我已经尝试了许多个月,学习如何IDirect3DVertexBuffer9和IDirect3DIndexBuffer9工作.我读过多本书,电子书和论坛,但我仍然无法理解他们的工作方式.有人可以帮我理解它们的工作方式以及它们如何连接在一起吗?
PS:我试过搜索相关问题,但没有什么比我感兴趣了.
谢谢.
这些问题相对简单.使用向量时,我应该new在推回新元素时使用运算符吗?我应该拨打哪种发布方法?这就是我的意思:
// Release method: 1.
void ReleaseMethodOne( vector< int * > &ThisVector )
{
// Clear out the vector.
ThisVector.clear( );
return;
}
// Release method: 2.
void ReleaseMethodTwo( vector< int * > &ThisVector )
{
// Clear out the vector.
for( unsigned uIndex( 0 ); uIndex < ThisVector.size( ); uIndex++ )
{
delete ThisVector.at( uIndex );
}
return;
}
int main( )
{
vector< int * > Vector;
// Add a new element.
Vector.push_back( new int( 2 …Run Code Online (Sandbox Code Playgroud) 可能重复:
是否值得在析构函数中设置指向NULL的指针?
NULL在析构函数中设置指针(分配堆内存)是没有意义的吗?
class SampleClass
{
public:
SampleClass( int Init = 0 )
{
Value = new int( Init );
}
~SampleClass( void )
{
delete Value;
Value = NULL; // Is this pointless?
}
int *Value;
};
Run Code Online (Sandbox Code Playgroud)
关于课程的主题,我explicit什么时候应该使用关键字?