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

C++ combine函数代码示例

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

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



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

示例1: PLB_PRECONDITION

void MultiBlock3D::addModifiedBlocks (
        plint level,
        std::vector<MultiBlock3D*> modifiedBlocks,
        std::vector<modif::ModifT> typeOfModification,
        std::vector<std::vector<BlockAndModif> >& multiBlockCollection,
        bool includesEnvelope )
{
    PLB_PRECONDITION( modifiedBlocks.size() == typeOfModification.size() );
    // Resize vector which collects modified blocks (resize needs to be
    //   done even when no block is added, to avoid memory violations
    //   during read access to the vector).
    if ((pluint)level >= multiBlockCollection.size()) {
        multiBlockCollection.resize(level+1);
    }
    // Unless envelope is already included in the domain of application of the data
    //   processor, subscribe modified blocks for an update of the envelope.
    if (!includesEnvelope) {
        for (pluint iNewBlock=0; iNewBlock<modifiedBlocks.size(); ++iNewBlock) {
            bool alreadyAdded=false;
            // Check if the block is already in the collection.
            // Note: It may seem stupid to use a linear-complexity algorithm to
            // find existing blocks. However, it would be a mistake to store the data
            // processors in a sorted structure. Indeed, sorting pointers leads to
            // an unpredictable order (because the pointers have an unpredictable value).
            // This is a problem in parallel programs, because different threads may find a
            // different order, and the communication pattern between processes gets messed up.
            for (pluint iOriginal=0; iOriginal<multiBlockCollection[level].size(); ++iOriginal) {
                MultiBlock3D* existingBlock = multiBlockCollection[level][iOriginal].first;
                if (existingBlock == modifiedBlocks[iNewBlock]) {
                    // If the block already exists, simply update the type of modification
                    // that applies to it.
                    modif::ModifT& existingModif = multiBlockCollection[level][iOriginal].second;
                    existingModif = combine( existingModif, typeOfModification[iNewBlock] );
                    alreadyAdded = true;
                }
            }
            // If the block is not already in the structure, add it.
            if (!alreadyAdded) {
                multiBlockCollection[level].push_back (
                        BlockAndModif( modifiedBlocks[iNewBlock], typeOfModification[iNewBlock] ) );
            }
        }
    }
}
开发者ID:jannickseelen,项目名称:Palabos,代码行数:44,代码来源:multiBlock3D.cpp


示例2: TAOLIB_DEBUG

    CORBA::Object_ptr
    ImR_Client_Adapter_Impl::imr_key_to_object(TAO_Root_POA* poa,
                                               const TAO::ObjectKey &key,
                                               const char* type_id) const
    {
      TAO_ORB_Core& orb_core = poa->orb_core ();
      // Check to see if we alter the IOR.
      CORBA::Object_var imr = orb_core.implrepo_service ();

      if (CORBA::is_nil (imr.in ())
          || !imr->_stubobj ()
          || !imr->_stubobj ()->profile_in_use ())
        {
          if (TAO_debug_level > 1)
            {
              TAOLIB_DEBUG ((LM_DEBUG,
                             ACE_TEXT ("TAO_ImR_Client (%P|%t) - Missing ImR IOR, will not use the ImR\n")));
            }
          return CORBA::Object::_nil();
        }

      const TAO_MProfile& base_profiles = imr->_stubobj ()->base_profiles ();
      CORBA::String_var key_str;
      TAO::ObjectKey::encode_sequence_to_string (key_str.inout (), key);

      // if there is only one profile, no need to use IORManipulation
      if (base_profiles.profile_count() == 1)
        {
          return combine(orb_core,
                         *base_profiles.get_profile(0),
                         key_str.in(),
                         type_id);
        }

      // need to combine each profile in the ImR with the key and
      // then merge them all together into one ImR-ified ior
      ImRifyProfiles imrify (base_profiles,
                             imr->_stubobj ()->profile_in_use (),
                             orb_core,
                             key_str,
                             type_id);

      return imrify.combined_ior ();
    }
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:44,代码来源:ImR_Client.cpp


示例3: plot_funz_a2

void plot_funz_a2(const char *out_path,const char *title,const char *xlab,const char *ylab,double *X,bvec &Y,bvec &par,double (*fun)(double,double,double,double,double,double),boot &chiral_extrap_cont)
{
  //setup the plot
  grace out(out_path);
  out.plot_size(800,600);
  out.plot_title(combine("Continuum extrapolation of %s",title).c_str());
  out.axis_label(xlab,ylab);
  
  //plot the function with error
  double X_pol[100],X2_pol[100];
  bvec Y_pol(100,nboot,njack);
  for(int iens=0;iens<100;iens++)
    {
      X_pol[iens]=0.1/99*iens;
      X2_pol[iens]=X_pol[iens]*X_pol[iens];
	for(int iboot=plot_iboot=0;iboot<nboot+1;plot_iboot=iboot++)
	  Y_pol.data[iens].data[iboot]=fun(par[0][iboot],par[1][iboot],par[2][iboot],par[3][iboot],ml_phys[iboot],X_pol[iens]/hc);
    }
  out.set(1,"yellow");
  out.polygon(X2_pol,Y_pol);
  out.new_set();
  out.set(1,"red");
  out.set_line_size(2);
  out.ave_line(X2_pol,Y_pol);
  out.new_set();

  //plot the data with error
  for(int ib=0;ib<nbeta;ib++)
    {
      out.set(4,"none",set_symbol[ib],set_color[ib],"filled");
      out.set_legend(set_legend_fm[ib]);
      out.set_line_size(2);
      out.fout<<"@type xydy"<<endl;
      out.fout<<X[ib]*X[ib]<<" "<<Y.data[ib]<<endl;
      out.new_set();
    }
  
  //plot the extrapolated point with error
  out.set(4,"none","circle","indigo","filled");
  out.set_line_size(3);
  out.set_legend("Physical point");
  out.print_graph(0,chiral_extrap_cont);
  out.new_set();
}
开发者ID:sunpho84,项目名称:sunpho,代码行数:44,代码来源:extr_adim.cpp


示例4: updateTree

void updateTree(int index, int pos, int bl, int br, int val)
{
  if(bl == br)
  {
    tree[index].sum = val;
    tree[index].pref_sum = tree[index].suff_sum = tree[index].ans = max(0, val);
    return;
  }
  int localCenter = bl + (br - bl) / 2;
  if(pos <= localCenter)
  {
    updateTree(index * 2 + 1, pos, bl, localCenter, val);
  }
  else
  {
    updateTree(index * 2 + 2, pos, localCenter + 1, br, val);
  }
  tree[index] = combine(tree[index * 2 + 1], tree[index * 2 + 2]);
}
开发者ID:tupieurods,项目名称:SportProgramming,代码行数:19,代码来源:main.cpp


示例5: combine

void combine(int maxLength, int currentPosition, char toPrint[output_length]) {		
	if(currentPosition < maxLength) {
		for(int i = 0; i < array_size; ++i) {
			
			char newArray[output_length + 1];
			memcpy(newArray, toPrint, sizeof(toPrint));
			newArray[currentPosition] = letters[i];
			newArray[currentPosition + 1] = '\0';

			if(currentPosition + 1 == maxLength) {
				printf("%s\n", &newArray);
				counter++;
			}
			
			combine(maxLength, currentPosition + 1, newArray);
		}
		
	} 
}
开发者ID:nahlik-michal,项目名称:PJC-cv2,代码行数:19,代码来源:kombinace_rekurze.cpp


示例6: merge

 ListNode* merge(ListNode* l, ListNode* r) {
     ListNode combine(0);
     ListNode* lastNode = &combine;
     while (l != NULL && r != NULL) {
         if (l->val < r->val) {
             lastNode->next = l;
             l = l->next;
         } else {
             lastNode->next = r;
             r = r->next;
         }
         lastNode = lastNode->next;
     }
     if (l != NULL)
         lastNode->next = l;
     else
         lastNode->next = r;
     return combine.next;
 }
开发者ID:hongchh,项目名称:leetcode,代码行数:19,代码来源:023-merge-k-sorted-lists.cpp


示例7: luaC_complie

const char* luaC_complie(lua_State* L, const char* szSrcFile, const char* szDesFile)
{
	const Proto* f;
	FILE* D;
	if (luaL_loadfile(L,szSrcFile)!=0)
	{
		return lua_tostring(L, -1);
	}
	f = combine(L, 1);


	D = fopen_k(szDesFile, "wb");
	lua_lock(L);
	luaU_dump(L, f, writer, D, 0);
	lua_unlock(L);
	fclose(D);
	
	return 0;
}
开发者ID:zhuxiaokun,项目名称:workshop,代码行数:19,代码来源:luacompiler.c


示例8: luaC_complieN

const char* luaC_complieN(lua_State* L, const char* szDesFile, int count)
{
	const Proto* f;
	FILE* D;
	if (!lua_checkstack(L, count))
	{
		return "too much files, can not compile once";
	}
	f = combine(L, count);


	D = fopen_k(szDesFile, "wb");
	lua_lock(L);
	luaU_dump(L, f, writer, D, 0);
	lua_unlock(L);
	fclose(D);

	return 0;
}
开发者ID:zhuxiaokun,项目名称:workshop,代码行数:19,代码来源:luacompiler.c


示例9: query

//Complexity: O(log n)
int query(int t, int i, int j, int l, int r) {
	if (l <=i && j <= r) {
		return seg[t];
	}
	int mid = (i + j) / 2;
	if (l <= mid) {
		if (r <= mid) {
			return query(t*2, i, mid, l, r);
		}
		else {
			int a = query(t*2, i, mid, l, r);
			int b = query(t*2 + 1,  mid + 1, j, l, r);
			return combine(a, b);
		}
	}
	else {
		return query(t*2 + 1,  mid + 1, j, l, r);
	}
}
开发者ID:ravsa,项目名称:Competitive-Coding,代码行数:20,代码来源:segtree.cpp


示例10: parallel_for

void parallel_for(Number lo, Number hi, const Body& body) {
#if defined(SEQUENTIAL_ELISION)
  for (Number i = lo; i < hi; i++)
    body(i);
    /* cilk_for not yet supported by mainline gcc
#elif defined(USE_CILK_RUNTIME)
  cilk_for (Number i = lo; i < hi; i++)
    body(i);
    */
#else
  struct { } output;
  using output_type = typeof(output);
  auto join = [] (output_type,output_type) { };
  auto _body = [&body] (Number i, output_type) {
    body(i);
  };
  combine(lo, hi, output, join, _body);
#endif
}
开发者ID:grtkachenko,项目名称:pasl,代码行数:19,代码来源:native.hpp


示例11: printf

int car_module::savedatetomysql()
{
	FILE* fpout;
	fpout=fopen("date.txt","w");
	if(fpout==NULL)
	{
		printf("can not open date.txt\n");
		return 1;
	}
	fprintf(fpout,"%d\n",mac);
	fprintf(fpout,"%d %d\n",rows,cols);
	fprintf(fpout,"%.3lf %.3lf\n",speed_rows,speed_cols);
	for(int i=0;i<rows*cols;i++)
	{
		fprintf(fpout,"%d ",combine(map_queue[i].id,map_queue[i].idle));
	}
	fclose(fpout);
	return 0;
}
开发者ID:flair2005,项目名称:mechanical_parking_system,代码行数:19,代码来源:car_module.cpp


示例12: subsets

 vector<vector<int>> subsets(vector<int>& nums) {
     vector<vector<int>> result;
     vector<int> solution;
     // empty set
     result.push_back(solution);
     
     if (nums.size() <= 0) {
         return result;
     }
     
     sort(nums.begin(), nums.end());
     
     for (int sub_size = 1; sub_size <= nums.size(); sub_size++) {
         // using backtracking, get all subset, which size is sub_size
         vector<vector<int>> subs = combine(nums, sub_size);
         // extend result: put sub in subs to result
         result.insert(result.end(), subs.begin(), subs.end());
     }
     return result;
 }
开发者ID:Shitaibin,项目名称:leetcode-2016,代码行数:20,代码来源:78.Subsets.cpp


示例13: merge

Matrix merge(const Matrix &A, const Matrix &B, int s, bool can_nine) {
	Matrix res;
	for ( int i = 0; i <= 9; i ++ )
		for ( int j = 0; j <= 9; j ++ ) {
			Info I1 = A.ele[i][j];
			I1.val ++;
			for ( int x = 1; x <= 9; x ++ )
				if ( (s & (1 << x)) || x == j || (can_nine && x == 9) ) {
					int t = x + j;
					if ( t >= 10 ) {
						t -= 10;
						for ( int k = 0; k <= 9; k ++ ) {
							Info I2 = B.ele[t][k];
							res.ele[i][k].update(combine(I1, I2));
						}
					}
				}
		}
	return res;
}
开发者ID:alxsoares,项目名称:OI,代码行数:20,代码来源:inint_TLE.cpp


示例14: PyList_GetItem

/* recursively generate a patch of all bins between start and end */
static struct flist *fold(PyObject *bins, Py_ssize_t start, Py_ssize_t end)
{
	Py_ssize_t len, blen;
	const char *buffer;

	if (start + 1 == end) {
		/* trivial case, output a decoded list */
		PyObject *tmp = PyList_GetItem(bins, start);
		if (!tmp)
			return NULL;
		if (PyObject_AsCharBuffer(tmp, &buffer, &blen))
			return NULL;
		return decode(buffer, blen);
	}

	/* divide and conquer, memory management is elsewhere */
	len = (end - start) / 2;
	return combine(fold(bins, start, start + len),
		       fold(bins, start + len, end));
}
开发者ID:Distrotech,项目名称:mercurial,代码行数:21,代码来源:mpatch.c


示例15: get_money_of_company

long long int get_money_of_company(double_queue_t *q, int idx, int id, long source) {
  void *query, *response;
  size_t qlen, response_size;
  int exit_on_signal = 0;
  combine(&query, &qlen, "%c %i %i", ACT_BANK_GET_SALDO, idx, id);
  if(double_queue_query(q, query, qlen, &response, &response_size, &exit_on_signal, source, bank_ip) != 0) {
    error("Error connecting to bank.");
    free(query);
    return -1;
  }
  long long int saldo = -1;
  free(query);
  if(match(response, response_size, "@c %ll", ACT_OK, &saldo) != 0) {
    error("Expected OK message - something went wrong.");
    free(response);
    return -1;
  }
  free(response);
  return saldo;
}
开发者ID:wojtex,项目名称:studia-so-archeo,代码行数:20,代码来源:bank_utils.c


示例16: if

/* virtual */ void
av::tools::UnionSelector::evaluate()
{
  av::tools::Selector::evaluate();

  if (TargetSet1.isEmpty())
  {
    if (!TargetSet2.isEmpty())
      SelectedTargets.setValue(TargetSet2.getValue());
    else if (!SelectedTargets.isEmpty())
      SelectedTargets.clear();
  }
  else if (TargetSet2.isEmpty())
    SelectedTargets.setValue(TargetSet1.getValue());
  else
  {
    const MFTargetHolder::ContainerType &set1 = TargetSet1.getValue();
    const MFTargetHolder::ContainerType &set2 = TargetSet2.getValue();
    MFTargetHolder::ContainerType selected_targets;

    for (MFTargetHolder::ContainerType::const_iterator holder1 = set1.begin();
         holder1 != set1.end(); ++holder1)
    {
      const SFContainer::ValueType &target = (*holder1)->Target.getValue();
      MFTargetHolder::ContainerType::const_iterator holder2 = find(set2, target);
      if (holder2 == set2.end())
        selected_targets.push_back(*holder1);
      else
        selected_targets.push_back(combine(*holder1, *holder2));
    }

    for (MFTargetHolder::ContainerType::const_iterator holder2 = set2.begin();
         holder2 != set2.end(); ++holder2)
    {
      if (!hasTarget(set1, (*holder2)->Target.getValue()))
        selected_targets.push_back(*holder2);
    }

    SelectedTargets.setValue(selected_targets);
  }
}
开发者ID:4og,项目名称:avango,代码行数:41,代码来源:UnionSelector.cpp


示例17: lua_dumpSourceCode

int lua_dumpSourceCode(lua_State* L, const char *sourceCode, const char* outputPath)
{
    if (luaL_loadstring(L, sourceCode) != LUA_OK)
    {
        fatal(lua_tostring(L,-1));
    }
    
    const Proto* f = combine(L, 1);
    if (listing)
    {
        luaU_print(f,listing>1);
    }
    
    if (dumping)
    {
        FILE* D = fopen(outputPath, "wb");
        
        if (D==NULL)
        {
            printf(" error to open file!\n");
        }
        
        lua_lock(L);
        
        luaU_dump(L,f,writer,D,stripping);
        
        lua_unlock(L);
        
        if (ferror(D))
        {
            printf("error in write!\n");
        }
        
        if (fclose(D))
        {
            printf("error in close!\n");
        }
    }
    
    return 0;
}
开发者ID:tearsofphoenix,项目名称:VeritasIDE,代码行数:41,代码来源:luac.c


示例18: switch

string Item::getModifiers(bool shorten) const {
  string artStr;
  if (attributes->artifactName) {
    artStr = *attributes->artifactName;
    if (!shorten)
      artStr = " named " + artStr;
  }
  EnumSet<ModifierType> printMod;
  switch (getClass()) {
    case ItemClass::WEAPON:
      printMod.insert(ModifierType::ACCURACY);
      printMod.insert(ModifierType::DAMAGE);
      break;
    case ItemClass::ARMOR:
      printMod.insert(ModifierType::DEFENSE);
      break;
    case ItemClass::RANGED_WEAPON:
    case ItemClass::AMMO:
      printMod.insert(ModifierType::FIRED_ACCURACY);
      break;
    default: break;
  }
  if (!shorten)
    for (auto mod : ENUM_ALL(ModifierType))
      if (attributes->modifiers[mod] != 0)
        printMod.insert(mod);
  vector<string> attrStrings;
  for (auto mod : printMod)
    attrStrings.push_back(withSign(attributes->modifiers[mod]) +
        (shorten ? "" : " " + Creature::getModifierName(mod)));
  if (!shorten)
    for (auto attr : ENUM_ALL(AttrType))
      if (attributes->attrs[attr] != 0)
        attrStrings.push_back(withSign(attributes->attrs[attr]) + " " + Creature::getAttrName(attr));
  string attrString = combine(attrStrings, true);
  if (!attrString.empty())
    attrString = " (" + attrString + ")";
  if (attributes->uses > -1 && attributes->displayUses) 
    attrString += " (" + toString(attributes->uses) + " uses left)";
  return artStr + attrString;
}
开发者ID:gustavsen,项目名称:keeperrl,代码行数:41,代码来源:item.cpp


示例19: kminstree

struct lledge * kminstree ( struct lledge *root, int n )
{
	struct lledge *temp = NULL ;
	struct lledge *p, *q ;
	int noofedges = 0 ;
	int i, p1, p2 ;

	for ( i = 0 ; i < n ; i++ )
		stree[i] = i ;
	for ( i = 0 ; i < n ; i++ )
		count[i] = 0 ;

	while ( ( noofedges < ( n - 1 ) ) && ( root != NULL ) )
	{
		p = root ;

		root = root -> next ;

		p1 = getrval ( p -> v1 ) ;
		p2 = getrval ( p -> v2 ) ;

		if ( p1 != p2 )
		{
			combine ( p -> v1, p -> v2 ) ;
			noofedges++ ;
			mincost += p -> cost ;
			if ( temp == NULL )
			{
				temp = p ;
				q = temp ;
			}
			else
			{
				q -> next = p ;
				q = q -> next ;
			}
			q -> next = NULL ;
		}
	}
	return temp ;
}
开发者ID:somit,项目名称:Cbookproblems,代码行数:41,代码来源:CH11PR3.C


示例20: main

int main()
{
    char s1[MAXL + 6];
    char s2[MAXL + 6];
    int t1, t2;
    init();
    initNode(0);
    nodeNumber = 1;
    wordNumber = 0;
    memset(color, 0, sizeof(color));
    while(~scanf("%s%s", s1, s2))
    {
        t1 = addWord(0, s1);
        t2 = addWord(0, s2);
        ++ color[t1];
        ++ color[t2];
        combine(t1, t2);
    }
    bool connectivity = true;
    int oddNumber = 0;
    for(int i=0;i<wordNumber;++i)
    {
        if(find(i) != find(0))
        {
            connectivity = false;
        }
        if(color[i] & 1)
        {
            ++ oddNumber;
        }
    }
    if(!connectivity || oddNumber > 2)
    {
        printf("Impossible\n");
    }
    else
    {
        printf("Possible\n");
    }
    return 0;
}
开发者ID:Noodle3D,项目名称:ZCookie,代码行数:41,代码来源:POJ2513+Colored+Sticks.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ comm_get_txspace函数代码示例发布时间:2022-05-30
下一篇:
C++ comb函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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