本文整理汇总了C++中TArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::end方法的具体用法?C++ TArray::end怎么用?C++ TArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::end方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareSprites
//==========================================================================
//
//
//
//==========================================================================
SortNode * HWDrawList::SortSpriteList(SortNode * head)
{
SortNode * n;
int count;
unsigned i;
static TArray<SortNode*> sortspritelist;
SortNode * parent=head->parent;
sortspritelist.Clear();
for(count=0,n=head;n;n=n->next) sortspritelist.Push(n);
std::stable_sort(sortspritelist.begin(), sortspritelist.end(), [=](SortNode *a, SortNode *b)
{
return CompareSprites(a, b) < 0;
});
for(i=0;i<sortspritelist.Size();i++)
{
sortspritelist[i]->next=NULL;
if (parent) parent->equal=sortspritelist[i];
parent=sortspritelist[i];
}
return sortspritelist[0];
}
示例2: main
int main()
{
TArray<string, 3> A(3,3,3);
for(int i = 0; i < A.shape(0); ++i) {
for(int j = 0; j < A.shape(1); ++j) {
for(int k = 0; k < A.shape(2); ++k) {
ostringstream so;
so << i << "," << j << "," << k;
A(i,j,k) = so.str();
}
}
}
TArray<string, 3> B;
permute(A, {2,1,0}, B);
auto itrA = A.begin();
auto itrB = B.begin();
while (itrA != A.end() && itrB != B.end()) {
cout << *itrA << " -> " << *itrB << endl;
++itrA;
++itrB;
}
return 0;
}
示例3: catch
//---------------------------------------------------------------------------------------------
// Crash when iterating an empty array.
//---------------------------------------------------------------------------------------------
TEST_F( TArrayTest, bug_IterateEmptyListTest ) {
TArray<float> arrayInstance;
bool ok = true;
try {
for( TArray<float>::Iterator it = arrayInstance.begin( ); it != arrayInstance.end( ); ++it );
} catch ( ... ) {
ok = false;
}
EXPECT_TRUE( ok );
}
示例4: i
TEST_F( TArrayTest, iterateTest ) {
TArray<float> arrayInstance;
createArray( ArrayData, ArraySize, arrayInstance );
size_t i( 0 );
for( TArray<float>::Iterator it = arrayInstance.begin( ); it != arrayInstance.end( ); ++it ) {
++i;
}
EXPECT_EQ( i, arrayInstance.size() );
}
示例5:
TEST_F( TArrayTest, removeItTest) {
TArray<float> arrayInstance;
arrayInstance.add( 1.0f );
EXPECT_EQ( 1, arrayInstance.size() );
TArray<float>::Iterator it = arrayInstance.find( 1.0f );
EXPECT_NE( arrayInstance.end(), it );
arrayInstance.remove( it );
EXPECT_EQ( 0, arrayInstance.size() );
}
示例6: main
int main()
{
cout<<"TArray example: \n";
TArray<int> testArray;
testArray.push_back(10);
testArray.push_back(20);
testArray.push_front(1);
testArray.Clear();
for(TArray<int>::iterator it=testArray.begin();it!=testArray.end();it++)
cout<<*it<<endl;
cout<<"TBinaryTree example: \n";
TBinaryTree<int> tree;
tree.addElement(20);
tree.addElement(10);
tree.addElement(40);
tree.addElement(2);
tree.addElement(12);
tree.remove(10);
tree.displayPreOrder();
cout<<"TDeque example: \n";
TDeque<int> deque;
deque.push_back(10);
deque.push_front(20);
deque.push_front(30);
deque.push_back(3);
for(TDeque<int>::iterator it=deque.begin();it!=deque.end();it++)
cout<<*it<<endl;
cout<<"Show items without iterators:\n";
for(int i=0;i<deque.Size();i++)
cout<<deque[i]<<endl;
TList<int> list;
return 0;
}