本文整理汇总了C++中DoubleLinkedList::Insert方法的典型用法代码示例。如果您正苦于以下问题:C++ DoubleLinkedList::Insert方法的具体用法?C++ DoubleLinkedList::Insert怎么用?C++ DoubleLinkedList::Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleLinkedList
的用法示例。
在下文中一共展示了DoubleLinkedList::Insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test
void Test()
{
//////////////////////////////////
// MEMORY ALLOCATION TEST CODE //
//////////////////////////////////
int* test = MemoryManager::AllocateMemory<int>();
assert(!IsBadWritePtr(test, sizeof(int)), "Memory allocation test failed: allocate");
MemoryManager::FreeMemory(test);
assert(IsBadWritePtr(test, sizeof(int)), "Memory free test failed: free");
////////////////////////////////////
// DOUBLY LINKED LIST TEST CODE //
////////////////////////////////////
int* testint = MemoryManager::AllocateMemory<int>(10);
testint[0] = 5;
testint[1] = 12;
testint[2] = 32;
testint[3] = -2;
testint[4] = 124125;
DoubleLinkedList<int> TestList;
DoubleLinkedList<int>::Node* testnode = TestList.Insert(&testint[0]);
TestList.Insert(&testint[1]);
TestList.Insert(&testint[2]);
TestList.Insert(&testint[3]);
TestList.Insert(&testint[4]);
assert(*testnode->Item == 5, "Doubly linked list test failed: set");
assert(*testnode->Next->Item == 12, "Doubly linked list test failed: next");
TestList.Remove(testnode);
///////////////////////////////
// POOL ALLOCATOR TEST CODE //
///////////////////////////////
//Create a pool of floats with length 10
Pool<float>* TestPool = new Pool<float>(10);
assert(TestPool != nullptr, "P ool allocator fails");
//Get three values from the pool
float* first = TestPool->Get();
float* second = TestPool->Get();
float* third = TestPool->Get();
//Set their values
*second = 2.f;
*third = 123.4f;
//Delete the pool
delete TestPool;
//////////////////////
// LOGING TEST CODE //
//////////////////////
Log TestLog("TestLog.txt");
TestLog.Write("Hello!");
TestLog.Write("I am a cheese");
}