• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ SList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getLaneParentsChilds

bool HistoryView::getLaneParentsChilds(SCRef sha, int x, SList p, SList c) {

	ListViewDelegate* lvd = static_cast<ListViewDelegate*>(itemDelegate());
	uint lane = x / lvd->laneWidth();
	int t = getLaneType(sha, lane);
	if (t == EMPTY || t == -1)
		return false;

	// first find the parents
	p.clear();
	QString root;
	if (!isFreeLane(t)) {
		p = git->revLookup(sha, fh)->parents(); // pointer cannot be NULL
		root = sha;
	} else {
		SCRef par(git->getLaneParent(sha, lane));
		if (par.isEmpty()) {
			dbs("ASSERT getLaneParentsChilds: parent not found");
			return false;
		}
		p.append(par);
		root = p.first();
	}
	// then find children
	c = git->getChilds(root);
	return true;
}
开发者ID:simonwagner,项目名称:qgitx,代码行数:27,代码来源:historyview.cpp


示例2: CheckIntersect

bool CheckIntersect( SList &slist1,  SList &slist2) {
   SLNode *p1 = slist1.head(), *p2 = slist2.head();
  if (!p1 || !p2) return false;
  SLNode* cross1 = CheckCircle(slist1);
  SLNode* cross2 = CheckCircle(slist2);
  // both has no circle
  if (!cross1 && !cross2) {
    // method1: check tails
    //while (p1->next) p1 = p1->next;
    //while (p2->next) p2 = p2->next;
    //return p1 == p2;
    
    //method2: connect list1 head and tail, check circle
    //         circle cross point is intersect point
    slist1.tail()->next = slist1.head();
    cross2 = CheckCircle(slist2);
    cout << "Intersect point " << cross2->val << endl;
    if (cross2) return true;
  } else if (cross1 && cross2){
    // both has circle 
    p1 = slist1.head();
    bool pass = false;
    while (p1) {
      p1 = p1->next;
      if (p1 == cross2) return true;
      if (p1 == cross1) {
        if (pass) break;
        pass = true;
      } 
    }
  }
  return false;
}
开发者ID:pennymaxlw,项目名称:Algorithms_and_Data_Structures,代码行数:33,代码来源:ms100_007.cpp


示例3: fsg

void UpwardPlanRep::initMe()
{
	m_Gamma.init(*this);
	isAugmented = false;

	FaceSinkGraph fsg(m_Gamma, s_hat);
	SList<face> extFaces;
	fsg.possibleExternalFaces(extFaces);

	OGDF_ASSERT(!extFaces.empty());

	face f_ext = nullptr;
	for(face f : extFaces) {
		if (f_ext == nullptr)
			f_ext = f;
		else {
			if (f_ext->size() < f->size())
				f_ext = f;
		}
	}
	m_Gamma.setExternalFace(f_ext);
	for(adjEntry adj : s_hat->adjEntries) {
		if (m_Gamma.rightFace(adj) == m_Gamma.externalFace()) {
			extFaceHandle = adj;
			break;
		}
	}

	computeSinkSwitches();
}
开发者ID:ogdf,项目名称:ogdf,代码行数:30,代码来源:UpwardPlanRep.cpp


示例4: test_pop_front

void test_pop_front(Test* test)
{
	std::string s("hello");
	SList* list =new SList("hello","world");
	std::string act = list->pop_front();	
	test->equals(act,s);
	delete list;
}
开发者ID:anttitup,项目名称:c--harkka,代码行数:8,代码来源:Main.cpp


示例5: unify

void Annotate::unify(SList dst, SCList src) {

	const QString m("Merge");
	for (int i = 0; i < dst.size(); ++i) {
		if (dst.at(i) == m)
			dst[i] = src.at(i);
	}
}
开发者ID:ChunHungLiu,项目名称:qgit,代码行数:8,代码来源:annotate.cpp


示例6: test_push_front

void test_push_front(Test* test)
{
	std::string s("hello");
	SList* list = new SList("hello","word");
	list->push_front(s);
	std::string act=list->get_first()->get_stringi();
	test->equals(act,s);
	delete list;
}
开发者ID:anttitup,项目名称:c--harkka,代码行数:9,代码来源:Main.cpp


示例7: test_pop_back

void test_pop_back(Test* test)
{
	std::string s("world");
	SList* list = new SList("hello","world");
	std::cout<<(*list)<<std::endl;
	std::string act = list->pop_back();
	test->equals(act,s);
	delete list;		
}
开发者ID:anttitup,项目名称:c--harkka,代码行数:9,代码来源:Main.cpp


示例8: test_iter

void test_iter(Test* test)
{
	SList* list = new SList("hello","wordl");
	list->push_back("hi");
	list->push_back("why");
	for(SList_iterator it = list->begin();it!=list->end();it++)
		std::cout<<(*it).get_stringi()<<endl;
	delete list;
}
开发者ID:anttitup,项目名称:c--harkka,代码行数:9,代码来源:Main.cpp


示例9: test_reverse

void test_reverse(Test* test)
{
	SList* list = new SList("hello","wordl");
	list->push_back("hi");
	list->push_back("why");
	
	(*list).reverse();
	delete list;
}
开发者ID:anttitup,项目名称:c--harkka,代码行数:9,代码来源:Main.cpp


示例10: reverse

 void SList::reverse() {
   SList tmp;
   Elem *tmp_elem = front;
   while(tmp_elem) {
     tmp.push_front(tmp_elem->get_contents());
     tmp_elem = tmp_elem->next;
   }
   tmp.swap(*this);
 }
开发者ID:arrimurri,项目名称:SList,代码行数:9,代码来源:slist.cpp


示例11: main

int main() {
  SList ls;
  ls.Insert(8);
  ls.Insert(5);
  ls.Insert(4);
  ls.Insert(1);

  ls.Traversal();
  ls.ReverseTraversal();
}
开发者ID:pennymaxlw,项目名称:Algorithms_and_Data_Structures,代码行数:10,代码来源:ms100_058.cpp


示例12: run

void FrontIsEmpty::run()
{
    SList newList;
    try {
        string str = newList.front();
        fail();
    } catch (logic_error&) {
        pass();
    }
}
开发者ID:samitheberber,项目名称:SList,代码行数:10,代码来源:creation_tests.cpp


示例13: StealHalf

std::size_t Processer::StealHalf(Processer & other)
{
    std::size_t runnable_task_count = runnable_list_.size();
    SList<Task> tasks = runnable_list_.pop_back((runnable_task_count + 1) / 2);
    std::size_t c = tasks.size();
    DebugPrint(dbg_scheduler, "proc[%u] steal proc[%u] work returns %d.",
            other.id_, id_, (int)c);
    if (!c) return 0;
    other.runnable_list_.push(std::move(tasks));
    return c;
}
开发者ID:HunterChen,项目名称:libgo,代码行数:11,代码来源:processer.cpp


示例14: test_swap

void test_swap(Test* test)
{
	SList *list = new SList("hello","world");
	SList *list_ = new SList("hei","maailma");
	
	list->swap((*list_));
	std::cout<<(*list)<<std::endl;
	std::cout<<(*list_)<<std::endl;
	delete list;
	delete list_;
}
开发者ID:anttitup,项目名称:c--harkka,代码行数:11,代码来源:Main.cpp


示例15: main

int main(void){
	SList<int> mylist;
	mylist.pushFront(10);
	mylist.pushFront(20);
	mylist.pushBack(30);

	for(auto it=mylist.begin();it!=mylist.end();++it){
		cout << *it << endl;
	}
	return 0;

}
开发者ID:CatieXu,项目名称:dsa555-w16,代码行数:12,代码来源:tlistmain.cpp


示例16: to_slist

SList *PCCTS_AST::
to_slist()
{
	SList *list = new SList;
	PCCTS_AST *p;

	for (p=this; p!=NULL; p=p->right())
	{
		list->add(p);
	}
	return list;
}
开发者ID:Acidburn0zzz,项目名称:afdko,代码行数:12,代码来源:PCCTSAST.cpp


示例17: OnNextFrame

void SwndContainerImpl::OnNextFrame()
{
    if(!IsVisible(TRUE)) return;
    
    SList<ITimelineHandler*> lstCopy;
    CopyList(m_lstTimelineHandler,lstCopy);
    SPOSITION pos=lstCopy.GetHeadPosition();
    while(pos)
    {
        ITimelineHandler * pHandler=lstCopy.GetNext(pos);
        pHandler->OnNextFrame();
    }
}
开发者ID:sihai,项目名称:soui,代码行数:13,代码来源:SwndContainerImpl.cpp


示例18: getFiles

bool CommitImpl::getFiles(SList selFiles) {

	// check for files to commit
	selFiles.clear();
	QTreeWidgetItemIterator it(treeWidgetFiles);
	while (*it) {
		if ((*it)->checkState(0) == Qt::Checked)
			selFiles.append((*it)->text(0));
		++it;
	}

	return !selFiles.isEmpty();
}
开发者ID:rhaschke,项目名称:qgit,代码行数:13,代码来源:commitimpl.cpp


示例19: test7

void test7()
{
	SList list;
	list.PushBack(1);
	list.PushBack(2);
	list.PushBack(3);
	list.PushBack(4);
	list.PushBack(5);
	list.PushBack(6);
	list.Circle();
	cout << (list.CheckCycle())->_data << endl;
	cout << (list.GetCycleEntryNode(list.CheckCycle()))->_data << endl;
	cout << (list.GetCircleLength(list.CheckCycle())) << endl;
}
开发者ID:ellerymo,项目名称:MyCpp,代码行数:14,代码来源:test.cpp


示例20: main

int main()
{
	SList sList;

	sList.PrintList();

	int count = 10;
	while(count--)
	{
		AddElement(sList);
	}

	std::cout << "insert a elelment at pos 8" << std::endl;
	Node pos(8);
	Node node(101);

	sList.InsertElement(&node, &pos);
	sList.PrintList();
	std::cout << std::endl << "The Size : " << sList.GetListSize() << std::endl;

	std::cout << std::endl;
	std::cout << "delete a element node 8" << std::endl;
	Node del(8);
	sList.DeleteElement(&node);

	sList.PrintList();
	std::cout << std::endl << "The Size : " << sList.GetListSize() << std::endl;
	return 0;
}
开发者ID:Spider-shi,项目名称:LearnDataStructuresAndAlgorithms,代码行数:29,代码来源:main.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ SListConstIterator类代码示例发布时间:2022-05-31
下一篇:
C++ SLVec3f类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap