本文整理汇总了C++中DLList::print方法的典型用法代码示例。如果您正苦于以下问题:C++ DLList::print方法的具体用法?C++ DLList::print怎么用?C++ DLList::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DLList
的用法示例。
在下文中一共展示了DLList::print方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test4
void test4()
{
DLList list;
list << 1 << 1 << 2 << 3 << 5 << 8 << 13 << 21 << 34 << 55 << 89;
std::cout<<"List:"<<std::endl;
list.print();
std::cout<<std::endl<<"Sorted list:"<<std::endl;
list.printSorted();
std::cout<<std::endl<<"List:"<<std::endl;
list.print();
}
示例2: test3
void test3()
{
DLList list; int dave;
list << 1 << 1 << 1 << 0 << 0 << 12 << 123123;
std::cout<<"List:"<<std::endl;
list.print();
std::cout<<std::endl<<"Removing last index..."<<std::endl<<std::endl;
std::cout<<"List:"<<std::endl;
bool saved = list.removeLast(dave);
list.print(); std::cout<<std::endl;
std::cout<<"Removed element: "<<dave<<std::endl;
std::cout<<"Success? "<<((saved) ? "Yes." : "No.")<<std::endl;
}
示例3: test1
void test1()
{
DLList list;
list << 1 << 2 << 12 << 13 << 11 << 22;
std::cout<<"List:"<<std::endl;
list.print();
}
示例4: test5
void test5()
{
DLList list1, list2;
for (int x = 0; x < 100; ++x) {
if (x % 4 == 0)
list1 << x;
if (x % 5 == 0)
list2 << x;
}
std::cout<<"List1:"<<std::endl;
list1.print(); std::cout<<std::endl;
std::cout<<"List2:"<<std::endl;
list2.print(); std::cout<<std::endl;
std::cout<<"Intersection:"<<std::endl;
DLList * intersect = list1.intersection(list2);
intersect->print(); delete intersect;
}
示例5: fetchPage
void LRUCache::fetchPage(int pageNumber) {
/* find the page in the map */
unordered_map< int, Node* >::const_iterator it = directAccess.find(pageNumber);
/* if the page is found in the map */
if (it != directAccess.end()) {
/* move the page on to the head of the doubly list */
dlist.moveToHead( (Node*)it->second);
}
else {
/* if size of list is full */
if (dlist.size() == cacheSize-1)
dlist.removeTail();
/* add the node to the head of doubly list */
Node* node = dlist.addNode(pageNumber);
/* add the node in the map */
directAccess.insert(pair< int, Node* >(pageNumber,node));
}
dlist.print();
}