当前位置: 首页>>代码示例>>C++>>正文


C++ leaf函数代码示例

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


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

示例1: leaf

 forceinline void 
 OmegaTree<TaskView>::insert(int i) {
   leaf(i).e = tasks[i].e(); 
   leaf(i).env = 
     static_cast<long long int>(c)*tasks[i].est()+tasks[i].e();
   update(i);
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:7,代码来源:tree.hpp

示例2: connections

    [[nodiscard]] std::set<pt> connections() const {
        std::set<ptpair> S;
        std::set<pt>     P;

        for (size_t i = 0; i < size.x; ++i) {
            for (size_t j = 0; j < size.y; ++j) {
                for (int xx = 1; xx < 100; ++xx) {
                    double            x  = .01 * xx;
                    std::pair<pt, pt> pp = leaf(pt(i, j, x, 0), nullptr);

                    if ((pp.first != pt()) && (pp.second != pt())) {
                        if (S.count(pp) == 0) {
                            S.insert(pp);
                            P.insert(pt(i, j, x, 0));
                        }
                    }

                    pp = leaf(pt(i, j, 0, x), nullptr);

                    if ((pp.first != pt()) && (pp.second != pt())) {
                        if (S.count(pp) == 0) {
                            S.insert(pp);
                            P.insert(pt(i, j, 0, x));
                        }
                    }
                }
            }
        }
        return P;
    }
开发者ID:vbeffara,项目名称:Simulations,代码行数:30,代码来源:Square.cpp

示例3: leaf

void leaf(turtle_t &turt, double length)
{
  double factor,i;
  
factor=length/10;
 if(factor<=0.005)
   return;
 else{
  
   for(i=2.0;i<=4.2;i=i+0.2){
turt.forward(factor);
turt.turn_right(45);
leaf(turt,4.2*factor/i);
turt.forward(4.8*factor/i);
turt.backward_move(4.8*factor/i);
turt.turn_left(45);
turt.forward(factor/6);
turt.turn_left(45);
leaf(turt,4.2*factor/i);
turt.forward(4.8*factor/i);
turt.backward_move(4.8*factor/i);

turt.turn_right(45.15);

   }
turt.forward(factor/8);
turt.backward_move(length+3*factor);


}
     
     
}
开发者ID:stanlyjohn2,项目名称:toylogo,代码行数:33,代码来源:render_drawing.cpp

示例4: c

 OmegaTree<TaskView>::OmegaTree(Region& r, int c0,
                                const TaskViewArray<TaskView>& t)
   : TaskTree<TaskView,OmegaNode>(r,t), c(c0) {
   for (int i=tasks.size(); i--; ) {
     leaf(i).e = 0; leaf(i).env = -Limits::llinfinity;
   }
   init();
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:8,代码来源:tree.hpp

示例5: leaf

int leaf(Tnode *r)
{
	if(r==NULL)
		return 0;
	else if(r->lchild==NULL&&r->rchild==NULL)
		return 1;
	else
		return leaf(r->lchild)+leaf(r->rchild);
}
开发者ID:cqiyi,项目名称:kaoshi,代码行数:9,代码来源:e26.cpp

示例6: assignBMEWeights

void assignBMEWeights(meTree *T, double **A)
{
  meEdge *e;
  e = depthFirstTraverse(T,NULL);
  while (NULL != e) {
    if ((leaf(e->head)) || (leaf(e->tail)))
      BalWFext(e,A);
    else
      BalWFint(e,A);
    e = depthFirstTraverse(T,e);
  }
}      
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:12,代码来源:bme.cpp

示例7: leaf

int  leaf(BinTree T)
{
    int n1,n2;
    if(!T) return 0;
    else if((!T->lchild) &&  (!T->rchild))return 1;
    else
    {
        n1=leaf(T->lchild);
        n2=leaf(T->rchild);
        return(n1+n2);
    }
}
开发者ID:xhbang,项目名称:data_structure,代码行数:12,代码来源:bitree_basic.c

示例8: leaf

int leaf(node *r)
{
	if(!r)
		return 0;
	else
	{
		if( NULL == r->lChild &&
			NULL == r->rChild )
			return 1;
		else
			return leaf(r->rChild) + leaf(r->lChild);
	}
}
开发者ID:cqiyi,项目名称:kaoshi,代码行数:13,代码来源:___数据结构_e5.cpp

示例9: leaf

bool leaf(struct node *root,int le,int *lef)
{
    if(root==NULL)return true;
    if(root->left==NULL &&root->right==NULL)
    {
        if(*lef==0)
        {
            *lef=le;
            return true;
        }
        return(*lef==le);
    }
    return leaf(root->left,le+1,lef)&&
    leaf(root->right,le+1,lef);
}
开发者ID:mkhanw01,项目名称:DataStructure,代码行数:15,代码来源:chek_leaf_same_level.cpp

示例10: assert

 forceinline void 
 OmegaLambdaTree<TaskView>::shift(int i) {
   // i is in omega
   assert(leaf(i).env > -Limits::llinfinity);
   leaf(i).le = leaf(i).e;
   leaf(i).e = 0;
   leaf(i).lenv = leaf(i).env;
   leaf(i).env = -Limits::llinfinity;
   leaf(i).resLe = i;
   leaf(i).resLenv = i;
   update(i);
 }
开发者ID:Wushaowei001,项目名称:crossbow,代码行数:12,代码来源:tree.hpp

示例11: traverse

/*
 * traverse the whole tree in a deletion-safe way, calling node_before at
 * nodes, leaf at leaves, and node_after when back at nodes, passing data along
 * the way through nodes. data returned by leaf() is ignored.
 *
 * Hooks can modify the pointer they're given to remove or replace themselves.
 */
static void
traverse(topo_topology_t topology,
	 topo_obj_t *father,
	 void (*node_before)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void (*leaf)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void (*node_after)(topo_topology_t topology, topo_obj_t *obj, void *),
	 void *data)
{
  topo_obj_t *pobj, obj;

  if (!(*father)->first_child) {
    if (leaf)
      leaf(topology, father, data);
    return;
  }
  if (node_before)
    node_before(topology, father, data);
  if (!(*father))
    return;
  for (pobj = &(*father)->first_child, obj = *pobj;
       obj;
       /* Check whether the current obj was dropped.  */
       (*pobj == obj ? pobj = &(*pobj)->next_sibling : 0),
       /* Get pointer to next object.  */
	obj = *pobj)
    traverse(topology, pobj, node_before, leaf, node_after, data);
  if (node_after)
    node_after(topology, father, data);
}
开发者ID:BlueBrain,项目名称:FlowVR,代码行数:36,代码来源:topology.c

示例12: return

/*assumes tree is only trifurcated at root*/
tree *detrifurcate(tree *T)
{
  node *v, *w;
  edge *e, *f;
  v = T->root;
  if(leaf(v))
    return(T);
  if (NULL != v->parentEdge)
    {
      Rprintf ("Error: root %s is poorly rooted.\n",v->label);
      exit(0);
    }
  for(e = v->middleEdge, v->middleEdge = NULL; NULL != e; e = f )
    {
      w = e->head;
      v = e->tail;
      e->tail = w;
      e->head = v;
      f = w->leftEdge;
      v->parentEdge = e;
      w->leftEdge = e;
      w->parentEdge = NULL;
    }
  T->root = w;
  return(T);
}
开发者ID:rforge,项目名称:phyloc,代码行数:27,代码来源:me.c

示例13: if

void CPatcherWindow::UpdatePatcherStatus()
{
	m_patchProgress.SetRange(0, m_patchPaths.size());

	if(m_patchResult != PATCHER_SERVICE_RESULT_SUCCESS)
	{
		m_patchStatusLabel.SetText(_T("Patch failed."));
		m_patchProgress.SetPosition(m_patchPaths.size());
		m_patchProgress.SetState(PBST_ERROR);
	}
	else if(m_patchIdx == m_patchPaths.size())
	{
		//Complete
		m_patchStatusLabel.SetText(_T("Complete!"));
		m_patchProgressLabel.SetText(_T("100%"));
		m_patchProgress.SetPosition(m_patchIdx);
	}
	else
	{
		auto nextPatchPath = m_patchPaths[m_patchIdx];
		unsigned int patchPercent = static_cast<unsigned int>(static_cast<float>(m_patchIdx) / static_cast<float>(m_patchPaths.size()) * 100.f);
		m_patchProgress.SetPosition(m_patchIdx);
		m_patchStatusLabel.SetText(string_format(_T("Applying '%s'..."), nextPatchPath.leaf().native().c_str()).c_str());
		m_patchProgressLabel.SetText(string_format(_T("%d%%"), patchPercent).c_str());
	}
}
开发者ID:Allowed,项目名称:SeventhUmbral,代码行数:26,代码来源:PatcherWindow.cpp

示例14: post

static Tree *
post(Lex *lxp)
{
	Tree *lp;

	if ((lp = leaf(lxp)) == 0)
		return 0;
	switch (lxp->tok)
	{
	case ROP_EMPTY:	/* this was {0,0} ROP_BRACE */
		libuxre_regdeltree(lp, 1);
		lp = 0;
		/*FALLTHROUGH*/
	case ROP_BRACE:
	case ROP_STAR:
	case ROP_PLUS:
	case ROP_QUEST:
		if ((lp = libuxre_reg1tree(lxp->tok, lp)) == 0)
		{
			lxp->err = REG_ESPACE;
			return 0;
		}
		if (lxp->tok == ROP_BRACE)
			lp->right.info = lxp->info;
		/*FALLTHROUGH*/
	case ROP_NOP:	/* this was {1,1} ROP_BRACE */
		if (lex(lxp) != 0)
		{
			libuxre_regdeltree(lp, 1);
			return 0;
		}
		break;
	}
	return lp;
}
开发者ID:JamesLinus,项目名称:LiteBSD-Ports,代码行数:35,代码来源:regparse.c

示例15: root

// Converts a SyntaxNode tree to a Moses::GHKM::ParseTree.
std::auto_ptr<ParseTree> XmlTreeParser::ConvertTree(
    const SyntaxNode &tree,
    const std::vector<std::string> &words)
{
  std::auto_ptr<ParseTree> root(new ParseTree(tree.GetLabel()));
  const std::vector<SyntaxNode*> &children = tree.GetChildren();
  if (children.empty()) {
    if (tree.GetStart() != tree.GetEnd()) {
      std::ostringstream msg;
      msg << "leaf node covers multiple words (" << tree.GetStart()
          << "-" << tree.GetEnd() << "): this is currently unsupported";
      throw Exception(msg.str());
    }
    std::auto_ptr<ParseTree> leaf(new ParseTree(words[tree.GetStart()]));
    leaf->SetParent(root.get());
    root->AddChild(leaf.release());
  } else {
    for (std::vector<SyntaxNode*>::const_iterator p = children.begin();
         p != children.end(); ++p) {
      assert(*p);
      std::auto_ptr<ParseTree> child = ConvertTree(**p, words);
      child->SetParent(root.get());
      root->AddChild(child.release());
    }
  }
  return root;
}
开发者ID:braunefe,项目名称:minSpanMoses,代码行数:28,代码来源:XmlTreeParser.cpp


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